Closed dnpatilcariad closed 3 months ago
Hi @dnpatilcariad,
2.61.0 is not the latest Azure CLI(2.62.0).
If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.
Thank you for opening this issue, we will look into it.
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kamperiadis, @khkh-ms, @shreyabatra4.
I tried upgrading the Azure CLI version in another script task before updating appSettings, but it does not upgrade the Azure CLI version. It still remains at 2.61.0.
Upgrading Azure CLI Version to latest WARNING: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus WARNING: Your current Azure CLI version is 2.61.0. It will be updated to 2.62.0. WARNING: Updating Azure CLI with MSI from https://aka.ms/installazurecliwindows
WARNING: Downloading MSI to C:\Users\ContainerAdministrator\AppData\Local\Temp\azure-cli-msi\azure-cli-2.62.0.msi
WARNING: Installation started. Please complete the upgrade in the opened window.
To update extensions, please run az upgrade
again after completing the upgrade.
Finishing: Upgrade Azure CLI version
Hi @dnpatilcariad,
2.61.0 is not the latest Azure CLI(2.62.0).
If you haven't already attempted to do so, please upgrade to the latest Azure CLI version by following https://learn.microsoft.com/en-us/cli/azure/update-azure-cli.
@yonzhan, as per the suggestion above, If I try to install the latest CLI from the pipeline script task, CLI version is not getting upgraded.
UPDATE: I found that the issue with the pipeline script was with variable for resource group which was not getting correct value. It was causing Azure CLI command to update function app's appSettings.
I corrected the resource group name and it is working as expected.
Describe the bug
I am trying to use Azure CLI commands to update my function app appsettings and web configuration settings in Azure DevOps AzureCLI@2 task. It works seamlessly for stage slot for my function app (using --slot parameter), but corresponding command for production slot (either skipping --slot parameter or even using --slot production) does not work and throws AuthorizationFailed exception in AzureCLI Azure DevOps task even when using same serviceConnection name for invoking the Azure DevOps task. Similar (AutorizationFailed with respective scope name) message is thrown for "az functionapp config appsettings list", "az functionapp config appsettings set" and "az resource update" commands.
The service principal I am using has "Owner" role on the resource group containing the function app.
ERROR: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions/<>subscriptionId/resourceGroups/rg-name/providers/Microsoft.Web/sites/function-app-name' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed
If I try the same commands from PowerShell on my laptop, they work fine for both production as well as staging slot without any error
Related command
az functionapp config appsettings list, az functionapp config appsettings set, az resource update
Errors
ERROR: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions/<>subscriptionId/resourceGroups/rg-name/providers/Microsoft.Web/sites/function-app-name' or the scope is invalid. If access was recently granted, please refresh your credentials.
Code: AuthorizationFailed
Issue script & Debug output
$websiteContentShare = az functionapp config appsettings list
--name $functionAppName --resource-group $resourceGroupName
--query "[?name=='WEBSITE_CONTENTSHARE']" -o tsv --debug2024-08-03T06:15:45.4269920Z Trying to read WEBSITE_CONTENTSHARE for
2024-08-03T06:15:45.9634613Z DEBUG: cli.knack.cli: Command arguments: ['functionapp', 'config', 'appsettings', 'list', '--name', '', '--resource-group', '', '--query', "[?name=='WEBSITE_CONTENTSHARE']", '-o', 'tsv', '--debug']
2024-08-03T06:15:45.9635669Z DEBUG: cli.knack.cli: init debug log:
2024-08-03T06:15:45.9636206Z Cannot enable color.
2024-08-03T06:15:45.9636861Z DEBUG: cli.knack.cli: Event: Cli.PreExecute []
2024-08-03T06:15:45.9638309Z DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x015E5ED8>, <function OutputProducer.on_global_arguments at 0x01911028>, <function CLIQuery.on_global_arguments at 0x0192ED98>]
2024-08-03T06:15:45.9650172Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
2024-08-03T06:15:45.9651160Z DEBUG: cli.azure.cli.core: Modules found from index for 'functionapp': ['azure.cli.command_modules.appservice', 'azure.cli.command_modules.serviceconnector']
2024-08-03T06:15:45.9651780Z DEBUG: cli.azure.cli.core: Loading command modules:
2024-08-03T06:15:45.9652241Z DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
2024-08-03T06:15:46.2453992Z DEBUG: cli.azure.cli.core: appservice 0.280 79 270
2024-08-03T06:15:46.2706052Z DEBUG: cli.azure.cli.core: serviceconnector 0.025 20 307
2024-08-03T06:15:46.2706831Z DEBUG: cli.azure.cli.core: Total (2) 0.305 99 577
2024-08-03T06:15:46.2707320Z DEBUG: cli.azure.cli.core: Loaded 97 groups, 577 commands.
2024-08-03T06:15:46.2707739Z DEBUG: cli.azure.cli.core: Found a match in the command table.
2024-08-03T06:15:46.2708168Z DEBUG: cli.azure.cli.core: Raw command : functionapp config appsettings list
2024-08-03T06:15:46.2708633Z DEBUG: cli.azure.cli.core: Command table: functionapp config appsettings list
2024-08-03T06:15:46.2710544Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x02ADD7F8>]
2024-08-03T06:15:46.2711783Z DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\azp\agent_work_temp.azclitask\commands\2024-08-03.06-15-46.functionapp_config_appsettings_list.7452.log'.
2024-08-03T06:15:46.2716609Z INFO: az_command_data_logger: command args: functionapp config appsettings list --name {} --resource-group {} --query {} -o {} --debug
2024-08-03T06:15:46.2720189Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x02AED438>]
2024-08-03T06:15:46.4012929Z D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\cryptography/hazmat/backends/openssl/backend.py:17: UserWarning: You are using cryptography on a 32-bit Python on a 64-bit Windows Operating System. Cryptography will be significantly faster if you switch to using a 64-bit Python.
2024-08-03T06:15:46.6465393Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
2024-08-03T06:15:46.6466302Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x02B0BA28>, <function register_cache_arguments..add_cache_arguments at 0x02B1BC08>]
2024-08-03T06:15:46.6478648Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
2024-08-03T06:15:46.6479254Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
2024-08-03T06:15:46.6532763Z DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01911078>, <function CLIQuery.handle_query_parameter at 0x0192EDE8>, <function register_ids_argument..parse_ids_arguments at 0x02B1BBB8>]
2024-08-03T06:15:48.5202130Z DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=WebSiteManagementClient
2024-08-03T06:15:48.5202990Z DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='C:\azp\agent\_work\_temp\.azclitask\service_principal_entries.bin', encrypt=True
2024-08-03T06:15:48.5203621Z DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='C:\azp\agent\_work\_temp\.azclitask\msal_token_cache.bin', encrypt=True
2024-08-03T06:15:48.5204024Z DEBUG: cli.azure.cli.core.auth.binary_cache: load: C:\azp\agent_work_temp.azclitask\msal_http_cache.bin
2024-08-03T06:15:48.5204542Z DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
2024-08-03T06:15:48.5205370Z INFO: msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/
2024-08-03T06:15:48.5208687Z DEBUG: msal.authority: openid_config("https://login.microsoftonline.com//v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com//oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com//discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com//v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com//oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com//oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com//oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com//kerberos', 'tenant_region_scope': 'NA', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
2024-08-03T06:15:48.5210928Z DEBUG: msal.application: Broker enabled? None
2024-08-03T06:15:48.5211552Z DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
2024-08-03T06:15:48.5212169Z DEBUG: cli.azure.cli.core.auth.msal_authentication: ServicePrincipalCredential.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
2024-08-03T06:15:48.5212539Z DEBUG: msal.application: Cache hit an AT
2024-08-03T06:15:48.5213004Z DEBUG: msal.telemetry: Generate or reuse correlation_id: f665f1b6-6b79-4097-9982-34a7ff93fb9e
2024-08-03T06:15:48.5213839Z DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings/list?api-version=2023-01-01'
2024-08-03T06:15:48.5214448Z DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'POST'
2024-08-03T06:15:48.5214726Z DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
2024-08-03T06:15:48.5215102Z DEBUG: cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
2024-08-03T06:15:48.5215572Z DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'd20d7ff3-515f-11ef-8f23-92bed3f9a1a2'
2024-08-03T06:15:48.5216046Z DEBUG: cli.azure.cli.core.sdk.policies: 'CommandName': 'functionapp config appsettings list'
2024-08-03T06:15:48.5216502Z DEBUG: cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--name --resource-group --query -o --debug'
2024-08-03T06:15:48.5217136Z DEBUG: cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.61.0 (MSI) azsdk-python-core/1.28.0 Python/3.11.8 (Windows-10-10.0.20348-SP0) VSTS_980e504c-82b3-4531-9bda-1fcad4853388_build_280_0'
2024-08-03T06:15:48.5217818Z Trying to set app settings for
2024-08-03T06:15:48.5218207Z DEBUG: cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
2024-08-03T06:15:48.5218501Z DEBUG: cli.azure.cli.core.sdk.policies: Request body:
2024-08-03T06:15:48.5218784Z DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
2024-08-03T06:15:48.5219145Z DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
2024-08-03T06:15:48.5219957Z DEBUG: urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings/list?api-version=2023-01-01 HTTP/1.1" 403 524
2024-08-03T06:15:48.5220462Z DEBUG: cli.azure.cli.core.sdk.policies: Response status: 403
2024-08-03T06:15:48.5220734Z DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
2024-08-03T06:15:48.5221100Z DEBUG: cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
2024-08-03T06:15:48.5221470Z DEBUG: cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
2024-08-03T06:15:48.5221847Z DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Length': '524'
2024-08-03T06:15:48.5222234Z DEBUG: cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
2024-08-03T06:15:48.5222621Z DEBUG: cli.azure.cli.core.sdk.policies: 'Expires': '-1'
2024-08-03T06:15:48.5222983Z DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-failure-cause': 'gateway'
2024-08-03T06:15:48.5223573Z DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-request-id': ''
2024-08-03T06:15:48.5224032Z DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': ''
2024-08-03T06:15:48.5224561Z DEBUG: cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'WESTUS2:20240803T061547Z:'
2024-08-03T06:15:48.5225100Z DEBUG: cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
2024-08-03T06:15:48.5225510Z DEBUG: cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
2024-08-03T06:15:48.5225882Z DEBUG: cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
2024-08-03T06:15:48.5226409Z DEBUG: cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: B94868AF32E541CF812F739F772901F5 Ref B: CO6AA3150220021 Ref C: 2024-08-03T06:15:47Z'
2024-08-03T06:15:48.5226905Z DEBUG: cli.azure.cli.core.sdk.policies: 'Date': 'Sat, 03 Aug 2024 06:15:46 GMT'
2024-08-03T06:15:48.5227224Z DEBUG: cli.azure.cli.core.sdk.policies: Response content:
2024-08-03T06:15:48.5228387Z DEBUG: cli.azure.cli.core.sdk.policies: {"error":{"code":"AuthorizationFailed","message":"The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials."}}
2024-08-03T06:15:48.5229159Z DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
2024-08-03T06:15:48.5229630Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
2024-08-03T06:15:48.5230147Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 664, in execute
2024-08-03T06:15:48.5230700Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 731, in _run_jobs_serially
2024-08-03T06:15:48.5231250Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 723, in _run_job
2024-08-03T06:15:48.5231931Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/util.py", line 263, in empty_on_404
2024-08-03T06:15:48.5232479Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 701, in _run_job
2024-08-03T06:15:48.5233028Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 334, in call
2024-08-03T06:15:48.5233595Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
2024-08-03T06:15:48.5234193Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 1496, in get_app_settings
2024-08-03T06:15:48.5234806Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/_appservice_utils.py", line 20, in _generic_site_operation
2024-08-03T06:15:48.5235391Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer
2024-08-03T06:15:48.5236014Z File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/mgmt/web/v2023_01_01/operations/_web_apps_operations.py", line 19055, in list_application_settings
2024-08-03T06:15:48.5237201Z azure.core.exceptions.HttpResponseError: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5238007Z Code: AuthorizationFailed
2024-08-03T06:15:48.5239000Z Message: The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5239494Z
2024-08-03T06:15:48.5240552Z ERROR: cli.azure.cli.core.azclierror: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5241196Z Code: AuthorizationFailed
2024-08-03T06:15:48.5242174Z Message: The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5243637Z ERROR: az_command_data_logger: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5244506Z Code: AuthorizationFailed
2024-08-03T06:15:48.5245511Z Message: The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/config/list/action' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//config/appsettings' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:48.5246221Z DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x02ADD938>]
2024-08-03T06:15:48.5246535Z INFO: az_command_data_logger: exit code: 1
2024-08-03T06:15:48.5246825Z INFO: cli.main: Command ran in 1.528 seconds (init: 0.425, invoke: 1.103)
2024-08-03T06:15:48.5247142Z INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
2024-08-03T06:15:48.5247462Z INFO: telemetry.client: Accumulated 0 events. Flush the clients.
2024-08-03T06:15:48.5247783Z INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
2024-08-03T06:15:48.5248115Z INFO: telemetry.save: Save telemetry record of length 4859 in cache
2024-08-03T06:15:48.5248435Z INFO: telemetry.main: Begin creating telemetry upload process.
2024-08-03T06:15:48.5250059Z INFO: telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry__init__.pyc C:\azp\agent_work_temp.azclitask"
2024-08-03T06:15:48.5250543Z INFO: telemetry.process: Return from creating process
2024-08-03T06:15:48.5250834Z INFO: telemetry.main: Finish creating telemetry upload process.
2024-08-03T06:15:48.5251642Z D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\cryptography/hazmat/backends/openssl/backend.py:17: UserWarning: You are using cryptography on a 32-bit Python on a 64-bit Windows Operating System. Cryptography will be significantly faster if you switch to using a 64-bit Python.
2024-08-03T06:15:48.9484484Z ERROR: (AuthorizationFailed) The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites/' or the scope is invalid. If access was recently granted, please refresh your credentials.
2024-08-03T06:15:50.1037797Z Code: AuthorizationFailed
2024-08-03T06:15:50.1039132Z Message: The client '' with object id '' does not have authorization to perform action 'Microsoft.Web/sites/read' over scope '/subscriptions//resourceGroups//providers/Microsoft.Web/sites/' or the scope is invalid. If access was recently granted, please refresh your credentials.
Expected behavior
I should be able to read function app appsettings for the production slot similar to it working for the stage slot.
Environment Summary
2024-08-03T06:15:30.3002829Z ============================================================================== 2024-08-03T06:15:30.3003027Z Task : Azure CLI 2024-08-03T06:15:30.3003148Z Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent. 2024-08-03T06:15:30.3003416Z Version : 2.242.1 2024-08-03T06:15:30.3003511Z Author : Microsoft Corporation 2024-08-03T06:15:30.3003631Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli 2024-08-03T06:15:30.3003812Z ============================================================================== 2024-08-03T06:15:30.3435655Z ##[debug]Resource Utilization warnings is disabled, switch "DISABLE_RESOURCE_UTILIZATION_WARNINGS" variable to "true" if you want to enable it 2024-08-03T06:15:30.3716365Z ##[debug]Using node path: C:\azp\agent\externals\node20_1\bin\node.exe 2024-08-03T06:15:31.4532380Z ##[debug]agent.TempDirectory=C:\azp\agent_work_temp 2024-08-03T06:15:31.4533467Z ##[debug]loading inputs and endpoints 2024-08-03T06:15:31.4534092Z ##[debug]loading ENDPOINT_AUTH_ba541083-11af-4352-9f1c-c81774626ab5 2024-08-03T06:15:31.4534814Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_ba541083-11af-4352-9f1c-c81774626ab5_AUTHENTICATIONTYPE 2024-08-03T06:15:31.4535538Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_ba541083-11af-4352-9f1c-c81774626ab5_SERVICEPRINCIPALID 2024-08-03T06:15:31.4536145Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_ba541083-11af-4352-9f1c-c81774626ab5_SERVICEPRINCIPALKEY 2024-08-03T06:15:31.4536751Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_ba541083-11af-4352-9f1c-c81774626ab5_TENANTID 2024-08-03T06:15:31.4537258Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2024-08-03T06:15:31.4537811Z ##[debug]loading ENDPOINT_AUTH_SCHEME_ba541083-11af-4352-9f1c-c81774626ab5 2024-08-03T06:15:31.4538293Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2024-08-03T06:15:31.4538794Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2024-08-03T06:15:31.4539582Z ##[debug]loading INPUT_ADDSPNTOENVIRONMENT 2024-08-03T06:15:31.4540048Z ##[debug]loading INPUT_CONNECTEDSERVICENAMEARM 2024-08-03T06:15:31.4540536Z ##[debug]loading INPUT_CWD 2024-08-03T06:15:31.4541044Z ##[debug]loading INPUT_FAILONSTANDARDERROR 2024-08-03T06:15:31.4541533Z ##[debug]loading INPUT_KEEPAZSESSIONACTIVE 2024-08-03T06:15:31.4542044Z ##[debug]loading INPUT_POWERSHELLERRORACTIONPREFERENCE 2024-08-03T06:15:31.4542525Z ##[debug]loading INPUT_POWERSHELLIGNORELASTEXITCODE 2024-08-03T06:15:31.4543024Z ##[debug]loading INPUT_SCRIPTARGUMENTS 2024-08-03T06:15:31.4543490Z ##[debug]loading INPUT_SCRIPTLOCATION 2024-08-03T06:15:31.4543962Z ##[debug]loading INPUT_SCRIPTPATH 2024-08-03T06:15:31.4544451Z ##[debug]loading INPUT_SCRIPTTYPE 2024-08-03T06:15:31.4544951Z ##[debug]loading INPUT_USEGLOBALCONFIG 2024-08-03T06:15:31.4545439Z ##[debug]loading INPUT_VISIBLEAZLOGIN 2024-08-03T06:15:31.4545978Z ##[debug]loading SECRET_BLACKDUCKSCANNERACCOUNTTOKEN 2024-08-03T06:15:31.4546485Z ##[debug]loading SECRET_OPS-INFRA-RESOURCES-RG 2024-08-03T06:15:31.4547047Z ##[debug]loading SECRET_OPS-INFRA-RESOURCES-STORAGE-ACCOUNT 2024-08-03T06:15:31.4547560Z ##[debug]loading SECRET_OPS-INFRA-RESOURCES-STORAGE-ACCOUNT-SAS-KEY 2024-08-03T06:15:31.4548084Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN 2024-08-03T06:15:31.4548591Z ##[debug]loading SECRET_TEAMPLATFORM-PAT 2024-08-03T06:15:31.4549050Z ##[debug]loaded 28 2024-08-03T06:15:31.4549467Z ##[debug]Agent.ProxyUrl=undefined 2024-08-03T06:15:31.4551865Z ##[debug]Agent.CAInfo=undefined 2024-08-03T06:15:31.4552357Z ##[debug]Agent.ClientCert=undefined 2024-08-03T06:15:31.4552840Z ##[debug]Agent.SkipCertValidation=undefined 2024-08-03T06:15:31.4553442Z ##[debug]check path : C:\azp\agent_work_tasks\AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815\2.242.1\task.json 2024-08-03T06:15:31.4554120Z ##[debug]adding resource file: C:\azp\agent_work_tasks\AzureCLI_46e4be58-730b-4389-8a2f-ea10b3e5e815\2.242.1\task.json 2024-08-03T06:15:31.4554678Z ##[debug]system.culture=en-US 2024-08-03T06:15:31.4555136Z ##[debug]which 'az' 2024-08-03T06:15:31.4555608Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd' 2024-08-03T06:15:31.4556223Z ##[debug]Feature flag AZP_AZURECLIV2_SETUP_PROXY_ENV not found. Returning false as default. 2024-08-03T06:15:31.4556776Z ##[debug]scriptType=ps 2024-08-03T06:15:31.4557260Z ##[debug]scriptLocation=scriptPath 2024-08-03T06:15:31.4557850Z ##[debug]scriptArguments=-UserAssignedIdentityClientId 6bf9d835-db34-42d9-83da-db11f45e4c9c 2024-08-03T06:15:31.4558371Z ##[debug]powerShellErrorActionPreference=stop 2024-08-03T06:15:31.4558865Z ##[debug]Agent.Version=3.241.0 2024-08-03T06:15:31.4559308Z ##[debug]Agent.TempDirectory=C:\azp\agent_work_temp 2024-08-03T06:15:31.4559836Z ##[debug]scriptPath=C:\azp\agent_work\1\s\scripts\infra\Update-EcsmFunctionAppSettings.ps1 2024-08-03T06:15:31.4560317Z ##[debug]powerShellIgnoreLASTEXITCODE=false 2024-08-03T06:15:31.4578960Z ##[debug]which 'powershell' 2024-08-03T06:15:31.4579701Z ##[debug]found: 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' 2024-08-03T06:15:31.4580277Z ##[debug]which 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' 2024-08-03T06:15:31.4580865Z ##[debug]found: 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' 2024-08-03T06:15:31.4581449Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: -NoLogo 2024-08-03T06:15:31.4582044Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: -NoProfile 2024-08-03T06:15:31.4582718Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: -NonInteractive 2024-08-03T06:15:31.4583384Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: -ExecutionPolicy 2024-08-03T06:15:31.4584283Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: Unrestricted 2024-08-03T06:15:31.4584894Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: -Command 2024-08-03T06:15:31.4585765Z ##[debug]C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe arg: . 'C:\azp\agent_work_temp\azureclitaskscript1722665730885.ps1' 2024-08-03T06:15:31.4586419Z ##[debug]cwd=C:\azp\agent_work\1\s 2024-08-03T06:15:31.4693116Z ##[debug]scriptLocation=scriptPath 2024-08-03T06:15:31.4708250Z ##[debug]failOnStandardError=false 2024-08-03T06:15:31.4722898Z ##[debug]testing directory 'C:\azp\agent_work\1\s' 2024-08-03T06:15:31.4741657Z ##[debug]which 'az' 2024-08-03T06:15:31.4791807Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd' 2024-08-03T06:15:31.4793608Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg: --version 2024-08-03T06:15:31.4795344Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg: --version 2024-08-03T06:15:31.4796042Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd 2024-08-03T06:15:31.4796674Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd 2024-08-03T06:15:31.4797260Z ##[debug]arguments: 2024-08-03T06:15:31.4797791Z ##[debug]arguments: 2024-08-03T06:15:31.4798325Z ##[debug] --version 2024-08-03T06:15:31.4798867Z ##[debug] --version 2024-08-03T06:15:31.4799654Z [command]C:\Windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" --version" 2024-08-03T06:15:33.3213866Z WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade' 2024-08-03T06:15:33.3215390Z azure-cli 2.61.0 2024-08-03T06:15:33.3330253Z 2024-08-03T06:15:33.3370582Z core 2.61.0 2024-08-03T06:15:33.3546814Z telemetry 1.1.0 2024-08-03T06:15:33.3620946Z 2024-08-03T06:15:33.3755223Z Dependencies: 2024-08-03T06:15:33.3821415Z msal 1.28.0 2024-08-03T06:15:33.4636816Z azure-mgmt-resource 23.1.1 2024-08-03T06:15:33.5803557Z 2024-08-03T06:15:33.5809542Z Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe' 2024-08-03T06:15:33.5841288Z Extensions directory 'C:\Users\ContainerAdministrator.azure\cliextensions' 2024-08-03T06:15:33.6094950Z 2024-08-03T06:15:33.6313825Z Python (Windows) 3.11.8 (tags/v3.11.8:db85d51, Feb 6 2024, 21:52:07) [MSC v.1937 32 bit (Intel)] 2024-08-03T06:15:33.6426147Z 2024-08-03T06:15:33.6440891Z Legal docs and information: aka.ms/AzureCliLegal
Additional context
No response