Skip to content

Updating functionapp slot master key results in 'Operation returned an invalid status 'Not Found'' #31826

@rodrigolopes

Description

@rodrigolopes

Describe the bug

changing the master key of a functionapp slot results in 'Operation returned an invalid status 'Not Found''

Related command

az functionapp keys set -g -n --slot --key-type masterKey --key-name default --key-value ${masterKey}

Errors

Operation returned an invalid status 'Not Found'

Issue script & Debug output

$ az functionapp keys set -g -n --slot --key-type masterKey --key-name default --key-value ${masterKey} --debug
cli.knack.cli: Command arguments: ['functionapp', 'keys', 'set', '-g', '', '-n', '', '--slot', '', '--key-type', 'masterKey', '--key-name', 'default', '--key-value', '', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
Enable VT mode.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x01C42C08>, <function OutputProducer.on_global_arguments at 0x01D847F8>, <function CLIQuery.on_global_arguments at 0x01DA32F8>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'functionapp': ['azure.cli.command_modules.appservice', 'azure.cli.command_modules.serviceconnector']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: appservice 1.619 80 277
cli.azure.cli.core: serviceconnector 0.352 20 331
cli.azure.cli.core: Total (2) 1.971 100 608
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: Loaded 98 groups, 608 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : functionapp keys set
cli.azure.cli.core: Command table: functionapp keys set
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x03D01028>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '.azure\commands\2025-07-16.14-24-07.functionapp_keys_set.122908.log'.
az_command_data_logger: command args: functionapp keys set -g {} -n {} --slot {} --key-type {} --key-name {} --key-value {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x03D1BBB8>]
D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\cryptography/hazmat/backends/openssl/backend.py:8: 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.
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x03D360C8>, <function register_cache_arguments..add_cache_arguments at 0x04704848>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x04704898>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x01D84848>, <function CLIQuery.handle_query_parameter at 0x01DA3348>, <function register_ids_argument..parse_ids_arguments at 0x047047F8>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=WebSiteManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='v\.azure\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: .azure\msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/

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': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? True
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://management.core.windows.net//.default',), options={}
cli.azure.cli.core.auth.msal_credentials: UserCredential.acquire_token: scopes=['https://management.core.windows.net//.default'], claims_challenge=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: **************
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/**********/resourceGroups/**********/providers/Microsoft.Web/sites/******/slots/*******/host/default/masterKey/default?api-version=2023-01-01'
cli.azure.cli.core.sdk.policies: Request method: 'PUT'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '104'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '
'
cli.azure.cli.core.sdk.policies: 'CommandName': 'functionapp keys set'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n --slot --key-type --key-name --key-value --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.75.0 (MSI) azsdk-python-core/1.31.0 Python/3.12.10 (Windows-11-10.0.26100-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': ''
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"properties": {"name": "default", "value": "
*"}}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "PUT /subscriptions/
/resourceGroups/
/providers/Microsoft.Web/sites//slots//host/default/masterKey/default?api-version=2023-01-01 HTTP/1.1" 404 0
cli.azure.cli.core.sdk.policies: Response status: 404
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-operation-identifier': 'tenantId=
,objectId=/westeurope/'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-writes': '199'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-writes': '2999'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '
******'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': ''
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'WESTEUROPE:20250716T122409Z:
'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: ****************** Ref B: AMS231022012045 Ref C: 2025-07-16T12:24:09Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Wed, 16 Jul 2025 12:24:09 GMT'
cli.azure.cli.core.sdk.policies: 'Content-Length': '0'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies:
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in _run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 120, in handler
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/appservice/custom.py", line 7952, in update_host_key
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/tracing/decorator.py", line 94, in wrapper_use_tracer
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 41046, in create_or_update_host_secret_slot
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/exceptions.py", line 161, in map_error
azure.core.exceptions.ResourceNotFoundError: Operation returned an invalid status 'Not Found'

cli.azure.cli.core.azclierror: Operation returned an invalid status 'Not Found'
az_command_data_logger: Operation returned an invalid status 'Not Found'
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x03D01168>]
az_command_data_logger: exit code: 3
cli.main: Command ran in 5.880 seconds (init: 1.244, invoke: 4.636)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 3884 in cache file under C:\Users*.azure\telemetry\20250716142410164
telemetry.main: Begin creating telemetry upload process.
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:\Users*****.azure C:\Users*
.azure\telemetry\20250716142410164"
telemetry.process: Return from creating process 6968
telemetry.main: Finish creating telemetry upload process.

Expected behavior

no error and key updated

Environment Summary

$ az --version
azure-cli 2.75.0

core 2.75.0
telemetry 1.1.0

Extensions:
application-insights 1.2.3
bastion 0.2.5
front-door 1.0.17
ssh 2.0.1

Dependencies:
msal 1.33.0b1
azure-mgmt-resource 23.3.0

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users*.azure'
Extensions directory 'C:\Users*
.azure\cliextensions'

Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 11:58:42) [MSC v.1943 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

Metadata

Metadata

Labels

Auto-AssignAuto assign by botFunctionsaz functionappService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions