AppCmd command to change Environment Variable
From Logic Wiki
%systemroot%\system32\inetsrv\appcmd.exe set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site
in TFS just write
set config "<SITENAME>" -section:system.webServer/aspNetCore /+"environmentVariables.[name='ASPNETCORE_ENVIRONMENT',value='<VARIABLEVALUE>']" /commit:site