Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

az afd endpoint purge silently ignores non-existent resource group #30621

Open
HolisticDeveloper opened this issue Jan 7, 2025 · 2 comments
Open
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Network - Front Door Service Attention This issue is responsible by Azure service team.

Comments

@HolisticDeveloper
Copy link

Describe the bug

When calling az afd endpoint purge with a non-existent resource group name, there is no indication of the issue. I would expect an error message and/or a non-0 exit code to be returned.

Related command

az afd endpoint purge

Errors

No error message returned.

Issue script & Debug output

Script:

az afd endpoint purge --resource-group foo --profile-name bar --endpoint-name baz --content-paths '/*' --debug

Debug output:

cli.knack.cli: Command arguments: ['afd', 'endpoint', 'purge', '--resource-group', 'foo', '--profile-name', 'bar', '--endpoint-name', 'baz', '--content-paths', '/*', '--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 0x00000241FA30B2E0>, <function OutputProducer.on_global_arguments at 0x00000241FA6AC040>, <function CLIQuery.on_global_arguments at 0x00000241FA6D1440>]
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.749        21        58
cli.azure.cli.core: Total (1)                 0.749        21        58
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 21 groups, 58 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command  : afd endpoint purge
cli.azure.cli.core: Command table: afd endpoint purge
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x00000241FCB0DC60>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\**username**\.azure\commands\2025-01-07.16-27-04.afd_endpoint_purge.36960.log'.
az_command_data_logger: command args: afd endpoint purge --resource-group {} --profile-name {} --endpoint-name {} --content-paths {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x00000241FCB532E0>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x00000241FCB796C0>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x00000241FCB79800>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x00000241FCB798A0>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000241FA6AC0E0>, <function CLIQuery.handle_query_parameter at 0x00000241FA6D14E0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x00000241FCB79760>]
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\**username**\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\**username**\.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/**tenant_id**
msal.authority: openid_config("https://login.microsoftonline.com/**tenant_id**/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/**tenant_id**/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/**tenant_id**/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/**tenant_id**/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/**tenant_id**/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/**tenant_id**/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/**tenant_id**/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/**tenant_id**/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? True
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.windows.net//.default',), kwargs={}
cli.azure.cli.core.auth.msal_credentials: UserCredential.get_token: scopes=('https://management.core.windows.net//.default',), claims=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: cfcca36d-4070-43d4-8d98-e7685da069a4
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/**subscription_id**/resourceGroups/foo/providers/Microsoft.Cdn/profiles/bar/afdEndpoints/baz/purge?api-version=2024-02-01'
cli.azure.cli.core.sdk.policies: Request method: 'POST'
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': '24'
cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '2388a8cb-cd3e-11ef-9cf6-009337043d7c'
cli.azure.cli.core.sdk.policies:     'CommandName': 'afd endpoint purge'
cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--resource-group --profile-name --endpoint-name --content-paths --debug'
cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.67.0 (MSI) azsdk-python-core/1.31.0 Python/3.12.7 (Windows-11-10.0.22621-SP0)'
cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"contentPaths": ["/*"]}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/**subscription_id**/resourceGroups/foo/providers/Microsoft.Cdn/profiles/bar/afdEndpoints/baz/purge?api-version=2024-02-01 HTTP/1.1" 404 95
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': '95'
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-request-id': 'bba3849f-5b7d-4523-bbc1-a9e46e4dfa1c'
cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': 'bba3849f-5b7d-4523-bbc1-a9e46e4dfa1c'
cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'NORTHCENTRALUS:20250107T212705Z:bba3849f-5b7d-4523-bbc1-a9e46e4dfa1c'
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: 8AD5D9581EFB4412A00B5D0994AC128B Ref B: CH1AA2020612007 Ref C: 2025-01-07T21:27:04Z'
cli.azure.cli.core.sdk.policies:     'Date': 'Tue, 07 Jan 2025 21:27:04 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"ResourceGroupNotFound","message":"Resource group 'foo' could not be found."}}
cli.azure.cli.core.commands: Service returned 404 on the long-running delete or purge operation. CLI treats it as delete or purge successfully but service should fix this behavior.
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x00000241FCB53060>, <function _x509_from_base64_to_hex_transform at 0x00000241FCB53100>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x00000241FCB0DEE0>]
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 1.534 seconds (init: 0.268, invoke: 1.266)
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 3812 in cache file under C:\Users\**username**\.azure\telemetry\20250107162705304
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\**username**\.azure C:\Users\**username**\.azure\telemetry\20250107162705304"
telemetry.process: Return from creating process 29304
telemetry.main: Finish creating telemetry upload process.

Expected behavior

CLI should return a non-zero exit code and output an error message to the console.

Environment Summary

azure-cli                         2.67.0

core                              2.67.0
telemetry                          1.1.0

Extensions:
account                            0.2.5
application-insights               1.2.1
azure-devops                       1.0.1

Dependencies:
msal                              1.31.0
azure-mgmt-resource               23.1.1

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\brian.baker2\.azure\cliextensions'

Python (Windows) 3.12.7 (tags/v3.12.7:0b05ead, Oct  1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal


Your CLI is up-to-date.

Additional context

No response

@HolisticDeveloper HolisticDeveloper added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jan 7, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. Auto-Assign Auto assign by bot Network - Front Door Service Attention This issue is responsible by Azure service team. labels Jan 7, 2025
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @cdnfdsuppgithub, @t-bzhan, @gxue, @TracyYaoYao.

@yonzhan
Copy link
Collaborator

yonzhan commented Jan 7, 2025

Thank you for opening this issue, we will look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. Network - Front Door Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants