Skip to content

az afd profile create requires unallowed --location (regression?!) #31584

@andrewcooke-isti

Description

@andrewcooke-isti

Describe the bug

az afd profile create ... gives the error "InvalidArgumentValue: Missing required field: --location"

but

az afd profile create --location ... gives the error "unrecognized arguments: --location westus"

this is disturbingly similar to #28824

Related command

az afd profile create

Errors

az afd profile create -g cgsfr -n cgsfrcdn --sku Standard_AzureFrontDoor
InvalidArgumentValue: Missing required field: --location

afd profile create -g cgsfr -n cgsfrcdn --sku Standard_AzureFrontDoor --location westus
unrecognized arguments: --location westus

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs

Issue script & Debug output

az afd profile create -g cgsfr -n cgsfrcdn --sku Standard_AzureFrontDoor --debug
cli.knack.cli: Command arguments: ['afd', 'profile', 'create', '-g', 'cgsfr', '-n', 'cgsfrcdn', '--sku', 'Standard_AzureFrontDoor', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f27c45ab7e0>, <function OutputProducer.on_global_arguments at 0x7f27c42fa7a0>, <function CLIQuery.on_global_arguments at 0x7f27c433fce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'afd': ['azure.cli.command_modules.cdn']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: cdn 0.205 22 57
cli.azure.cli.core: Total (1) 0.205 22 57
cli.azure.cli.core: Loaded 22 groups, 57 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : afd profile create
cli.azure.cli.core: Command table: afd profile create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f27c36dff60>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2025-05-30.16-30-53.afd_profile_create.1186.log'.
az_command_data_logger: command args: afd profile create -g {} -n {} --sku {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f27c373c4a0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f27c373eca0>, <function register_cache_arguments..add_cache_arguments at 0x7f27c373ede0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f27c373ee80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f27c42fa840>, <function CLIQuery.handle_query_parameter at 0x7f27c433fd80>, <function register_ids_argument..parse_ids_arguments at 0x7f27c373ed40>]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/root/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /root/.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/8459323e-7005-470f-938a-28c21b05cc6c
msal.authority: openid_config("https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/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/8459323e-7005-470f-938a-28c21b05cc6c/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/8459323e-7005-470f-938a-28c21b05cc6c/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/8459323e-7005-470f-938a-28c21b05cc6c/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'}
msal.application: Broker enabled? None
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: a2edba03-f2a2-4eb3-9354-c0f86135599b
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/9ec7e5df-5a47-4953-83b4-949632ccb7f5/resourcegroups/cgsfr?api-version=2022-09-01'
cli.azure.cli.core.sdk.policies: Request method: 'GET'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '745df478-3d73-11f0-a759-8ec7878498c2'
cli.azure.cli.core.sdk.policies: 'CommandName': 'afd profile create'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-g -n --sku --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.73.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.8 (Linux-5.14.0-503.40.1.el9_5.x86_64-x86_64-with-glibc2.31)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: This request has no body
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "GET /subscriptions/9ec7e5df-5a47-4953-83b4-949632ccb7f5/resourcegroups/cgsfr?api-version=2022-09-01 HTTP/1.1" 404 97
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: 'Content-Length': '97'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'x-ms-failure-cause': 'gateway'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-reads': '249'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '3749'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '864ef6df-7e25-40c6-8669-f2e230328311'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '864ef6df-7e25-40c6-8669-f2e230328311'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'UKWEST:20250530T163053Z:864ef6df-7e25-40c6-8669-f2e230328311'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
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: 0B939903EEA647DEAD65CE214698ACB0 Ref B: AMS231032607017 Ref C: 2025-05-30T16:30:53Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Fri, 30 May 2025 16:30:53 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"ResourceGroupNotFound","message":"Resource group 'cgsfr' could not be found."}}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 53, in format_args
self.args._schema._fmt(ctx=self, value=self.args)
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_arg_fmt.py", line 415, in call
raise AAZInvalidArgValueError(
azure.cli.core.aaz.exceptions.AAZInvalidArgValueError: InvalidArgumentValue: Missing required field: --location

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/az/lib/python3.12/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 666, in execute
raise ex
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 734, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/commands/init.py", line 703, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 155, in call
return self._handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/az/lib/python3.12/site-packages/azure/cli/command_modules/cdn/aaz/latest/afd/profile/_create.py", line 34, in _handler
super()._handler(command_args)
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command.py", line 165, in _handler
self.ctx.format_args()
File "/opt/az/lib/python3.12/site-packages/azure/cli/core/aaz/_command_ctx.py", line 55, in format_args
raise InvalidArgumentValueError(str(err))
azure.cli.core.azclierror.InvalidArgumentValueError: InvalidArgumentValue: Missing required field: --location

cli.azure.cli.core.azclierror: InvalidArgumentValue: Missing required field: --location
az_command_data_logger: InvalidArgumentValue: Missing required field: --location
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f27c36e4220>]
az_command_data_logger: exit code: 1
cli.main: Command ran in 1.122 seconds (init: 0.115, invoke: 1.007)
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 4055 in cache file under /root/.azure/telemetry/20250530163054189
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /root/.azure /root/.azure/telemetry/20250530163054189"
telemetry.process: Return from creating process 1190
telemetry.main: Finish creating telemetry upload process.

az afd profile create -g cgsfr -n cgsfrcdn --sku Standard_AzureFrontDoor --location westus --debug
cli.knack.cli: Command arguments: ['afd', 'profile', 'create', '-g', 'cgsfr', '-n', 'cgsfrcdn', '--sku', 'Standard_AzureFrontDoor', '--location', 'westus', '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fad4ca8b7e0>, <function OutputProducer.on_global_arguments at 0x7fad4c7d67a0>, <function CLIQuery.on_global_arguments at 0x7fad4c81bce0>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'afd': ['azure.cli.command_modules.cdn']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: cdn 0.221 22 57
cli.azure.cli.core: Total (1) 0.221 22 57
cli.azure.cli.core: Loaded 22 groups, 57 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : afd profile create
cli.azure.cli.core: Command table: afd profile create
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fad4bbc3f60>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/root/.azure/commands/2025-05-30.16-31-27.afd_profile_create.1194.log'.
az_command_data_logger: command args: afd profile create -g {} -n {} --sku {} --location {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7fad4bc204a0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7fad4bc22ca0>, <function register_cache_arguments..add_cache_arguments at 0x7fad4bc22de0>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7fad4bc22e80>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.azure.cli.core.command_recommender: "--location" is an invalid parameter for command "afd profile create".
urllib3.connectionpool: Starting new HTTPS connection (1): app.aladdin.microsoft.com:443
urllib3.connectionpool: https://app.aladdin.microsoft.com:443 "GET /api/v1.0/suggestions?query=%7B%22command%22%3A+%22afd+profile+create%22%2C+%22parameters%22%3A+%22%22%7D&clientType=AzureCli&context=%7B%22versionNumber%22%3A+%222.73.0%22%2C+%22errorType%22%3A+%22UnrecognizedArguments%22%2C+%22correlationId%22%3A+%229e7c0148-5e98-46cd-8367-44010cea318b%22%2C+%22subscriptionId%22%3A+%229ec7e5df-5a47-4953-83b4-949632ccb7f5%22%2C+%22eventId%22%3A+%2297f292a5-3e78-4690-9647-3d04bf9d77eb%22%7D HTTP/1.1" 200 None
cli.azure.cli.core.command_recommender: "--location" is an invalid parameter for command "afd profile create".
cli.azure.cli.core.azclierror: NoneType: None

cli.azure.cli.core.azclierror: unrecognized arguments: --location westus
az_command_data_logger: unrecognized arguments: --location westus

Examples from AI knowledge base:
https://aka.ms/cli_ref
Read more about the command in reference docs
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fad4bbc8220>]
az_command_data_logger: exit code: 2
cli.main: Command ran in 0.490 seconds (init: 0.122, invoke: 0.367)
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 3981 in cache file under /root/.azure/telemetry/20250530163127416
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /root/.azure /root/.azure/telemetry/20250530163127416"
telemetry.process: Return from creating process 1198
telemetry.main: Finish creating telemetry upload process.

Expected behavior

the profile should be created.

Environment Summary

az version
{
"azure-cli": "2.73.0",
"azure-cli-core": "2.73.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}

Additional context

cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botNetwork - Front DoorService 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