Azure / Azure/azure-cli

az costmanagement export uses old version of Exports API incompatible with Exports created using the latest API version..

Open
#32,769 3 comments 0 reactions 1 assignee Assigned to @a0x1ab View on GitHub
bug Cost Management customer-reported Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

"az costmanagement export" uses an old API version which is not compatible with Exports that were created with the latest Exports API's (API versions 2025-03-01 and 2023-07-01-preview.). The Azure portal currently uses the latest Export API version (2025-03-01) during creation. Therefore, if you create an Export in the Azure Portal using the GUI; you won't be able to view nor manage that same Export using "az costmanagement export" due to the incompatibility of API versions.

Please find below some examples of this issue:

**az costmanagement export list**

**API version used by command**: 2020-06-01
**Issue description:** Incompatible with Exports created using API versions 2025-03-01 and 2023-07-01-preview. When you run the command, any Export created with API versions 2025-03-01 and 2023-07-01-preview will not show in the response. No error message.

**az costmanagement export show**

**API version used by command:** 2020-06-01
**Issue description:** Incompatible with Exports created using API versions 2025-03-01 and 2023-07-01-preview. When running the command for an Export created with API versions 2025-03-01 and 2023-07-01-preview, the API returns a 404 not found response, even when the Export exists in the given scope.

**az costmanagement export delete**

**API version used by command:** 2020-06-01
**Issue description:** Incompatible with Exports created using API versions 2025-03-01 and 2023-07-01-preview. When running the command for an Export created with API versions 2025-03-01 and 2023-07-01-preview, the API returns a 404 not found response, even when the Export exists in the given scope.

### Related command

az costmanagement export list
az costmanagement export show
az costmanagement export delete
az costmanagement export update
az costmanagement export create

### Errors

{"error":{"code":"404","message":"No export found for {Export_Name}, Enrollment: 123456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)"}}

### Issue script & Debug output

PS C:\Users\user> az costmanagement export show --name "export_name" --scope "providers/Microsoft.Billing/billingAccounts/12456789" --debug
cli.knack.cli: Command arguments: ['costmanagement', 'export', 'show', '--name', 'export_name', '--scope', 'providers/Microsoft.Billing/billingAccounts/12456789', '--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 [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'costmanagement': ['azext_costmanagement']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
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: costmanagement 0.977 2 6 C:\Users\user\.azure\cliextensions\costmanagement
cli.azure.cli.core: Total (1) 0.977 2 6
cli.azure.cli.core: Loaded 2 groups, 6 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : costmanagement export show
cli.azure.cli.core: Command table: costmanagement export show
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\user\.azure\commands\2026-02-10.17-39-44.costmanagement_export_show.28148.log'.
az_command_data_logger: command args: costmanagement export show --name {} --scope {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x000002235EF46B60>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x000002235EF98EA0>, .add_cache_arguments at 0x000002235EF99080>, .update_breaking_change_info at 0x000002235EF99120>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x000002235EF98F40>]
az_command_data_logger: extension name: costmanagement
az_command_data_logger: extension version: 1.0.0
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=CostManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\user\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\user\.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/12334567-12345-12345-12345-1234567891
msal.authority: openid_config("https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic', 'self_signed_tls_client_auth'], 'jwks_uri': 'https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/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'], 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/12334567-12345-12345-12345-1234567891/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/12334567-12345-12345-12345-1234567891/kerberos', 'mtls_endpoint_aliases': {'token_endpoint': 'https://mtlsauth.microsoft.com/12334567-12345-12345-12345-1234567891/oauth2/v2.0/token'}, 'tls_client_certificate_bound_access_tokens': True, '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_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: f36cf4c7-bca8-4438-a5a8-ca042576f828
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/providers/Microsoft.Billing/billingAccounts/12456789/providers/Microsoft.CostManagement/exports/export_name?api-version=2020-06-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': 'c6947f8b-06d9-11f1-af6f-18cc189bc3f4'
cli.azure.cli.core.sdk.policies: 'CommandName': 'costmanagement export show'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '--name --scope --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.83.0 (MSI) azsdk-python-core/1.38.0 Python/3.13.11 (Windows-11-10.0.26200-SP0)'
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 /providers/Microsoft.Billing/billingAccounts/12456789/providers/Microsoft.CostManagement/exports/export_name?api-version=2020-06-01 HTTP/1.1" 404 136
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': '136'
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: 'session-id': '03a48f6e-7e6d-4615-ad44-47d99f11b1af'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '9d483edb-98e0-4099-bbc1-7efe54f940b0'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'c0318f6c-5fa6-4bea-896c-df28d1de0ad0'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'c6947f8b-06d9-11f1-af6f-18cc189bc3f4'
cli.azure.cli.core.sdk.policies: 'X-Powered-By': 'ASP.NET'
cli.azure.cli.core.sdk.policies: 'x-ms-operation-identifier': ''
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-tenant-reads': '249'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20260210T233945Z:c0318f6c-5fa6-4bea-896c-df28d1de0ad0'
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: BD8DEC7466254CA2A719ED4F7B97B13A Ref B: BN1AA2051013051 Ref C: 2026-02-10T23:39:45Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Tue, 10 Feb 2026 23:39:45 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"error":{"code":"404","message":"No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)"}}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 360, in handler
File "C:\Users\user\.azure\cliextensions\costmanagement\azext_costmanagement\manual\custom.py", line 107, in costmanagement_export_show
return client.get(scope=scope, export_name=export_name)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\.azure\cliextensions\costmanagement\azext_costmanagement\vendored_sdks\costmanagement\operations\_exports_operations.py", line 191, in get
map_error(status_code=response.status_code, response=response, error_map=error_map)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/core/exceptions.py", line 163, in map_error
azure.core.exceptions.ResourceNotFoundError: (404) No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)
Code: 404
Message: No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)

cli.azure.cli.core.azclierror: (404) No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)
Code: 404
Message: No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)
az_command_data_logger: (404) No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)
Code: 404
Message: No export found for export_name, Enrollment: 12456789. (Request ID: 9d483edb-98e0-4099-bbc1-7efe54f940b0)
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 3
cli.__main__: Command ran in 3.073 seconds (init: 0.714, invoke: 2.358)
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 4314 in cache file under C:\Users\user\.azure\telemetry\20260210173945932
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\user\.azure C:\Users\user\.azure\telemetry\20260210173945932"
telemetry.process: Return from creating process 37784
telemetry.main: Finish creating telemetry upload process.

### Expected behavior

The commands should be using the latest Exports API to allow Exports that have been created with any GA Export API version to be view and managed through the command.

### Environment Summary

azure-cli 2.83.0

core 2.83.0
telemetry 1.1.0

Extensions:
account 0.2.5
alias 0.5.2
costmanagement 1.0.0
subscription 0.1.3

Dependencies:
msal 1.35.0b1
azure-mgmt-resource 23.3.0

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

Python (Windows) 3.13.11 (tags/v3.13.11:6278944, Dec 5 2025, 16:26:58) [MSC v.1944 64 bit (AMD64)]

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.