Skip to content

azure batch account login fails with CLI version 2.69.0 #30913

@governmentSponsored

Description

@governmentSponsored

Describe the bug

When we attempt to log into an azure batch account using the AZ CLI version 2.69.0 it fails with the errors listed below. However, when we run the same exact command using 2.68.0 it works perfectly.

FYI this is in Azure US Government in case that changes behavior at all.

Related command

az batch account login \
    --name $azure_batch_account_name \
    --resource-group $azure_batch_account_resource_group

Errors

error 27-Feb-2025 18:14:59 ERROR: AADSTS500011: The resource principal named https://batch.core.windows.net/ was not found in the tenant named REDACTED. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant. Trace ID: dff2adea-1ffd-4f8d-bd12-c6afd7724e00 Correlation ID: 111e8afd-68b7-40d9-b393-4fd962c226a6 Timestamp: 2025-02-27 18:14:59Z
error 27-Feb-2025 18:14:59 Interactive authentication is needed. Please run:
error 27-Feb-2025 18:14:59 az login

Issue script & Debug output

28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Command arguments: ['batch', 'account', 'login', '--name', 'fakeName', '--resource-group', 'fakeGroup', '--debug']
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: __init__ debug log:
28-Feb-2025 12:27:37	Cannot enable color.
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: Cli.PreExecute []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7fd086d13740>, <function OutputProducer.on_global_arguments at 0x7fd086a5e700>, <function CLIQuery.on_global_arguments at 0x7fd086aa7c40>]
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Modules found from index for 'batch': ['azure.cli.command_modules.batch']
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Loading command modules:
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Name                  Load Time    Groups  Commands
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: batch                     0.099        32        96
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Total (1)                 0.099        32        96
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Loaded 32 groups, 96 commands.
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Found a match in the command table.
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Raw command  : batch account login
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core: Command table: batch account login
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7fd085c02de0>]
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/var/obfuscated/path/.azure/commands/2025-02-28.12-27-37.batch_account_login.396.log'.
28-Feb-2025 12:27:37	INFO: az_command_data_logger: command args: batch account login --name {} --resource-group {} --debug
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7fd085c43d80>]
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument.<locals>.add_ids_arguments at 0x7fd085c72160>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7fd085c722a0>, <function register_upcoming_breaking_change_info.<locals>.update_breaking_change_info at 0x7fd085c72340>]
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7fd086a5e7a0>, <function CLIQuery.handle_query_parameter at 0x7fd086aa7ce0>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7fd085c72200>]
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.commands.client_factory: Getting management service client client_type=BatchManagementClient
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/var/obfuscated/path/.azure/service_principal_entries.json', encrypt=False
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.auth.persistence: build_persistence: location='/var/obfuscated/path/.azure/msal_token_cache.json', encrypt=False
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.auth.binary_cache: load: /var/obfuscated/path/.azure/msal_http_cache.bin
28-Feb-2025 12:27:37	DEBUG: urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
28-Feb-2025 12:27:37	DEBUG: msal.authority: Initializing with Entra authority: https://login.microsoftonline.us/15ef12a1-af58-44c4-b029-712fc0605570
--REDACTED--
28-Feb-2025 12:27:37	DEBUG: msal.application: Broker enabled? None
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core._debug: Using CA bundle file at '/etc/ssl/certs/ca-bundle.pem'.
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token: scopes=('https://management.core.usgovcloudapi.net//.default',), kwargs={}
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.auth.msal_credentials: ServicePrincipalCredential.get_token: scopes=('https://management.core.usgovcloudapi.net//.default',), kwargs={}
28-Feb-2025 12:27:37	DEBUG: msal.application: Cache hit an AT
28-Feb-2025 12:27:37	DEBUG: msal.telemetry: Generate or reuse correlation_id: 21a1c8d5-c444-4203-8643-b08f18ee0792
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Request URL: 'https://management.usgovcloudapi.net/subscriptions/FAKE_SUBSCRIPTION_GUID/resourceGroups/fakeGroup/providers/Microsoft.Batch/batchAccounts/fakeName?api-version=2024-02-01'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Request method: 'GET'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Request headers:
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Accept': 'application/json'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'x-ms-client-request-id': '65058a36-f5cf-11ef-8ffc-ca0108fca41d'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'CommandName': 'batch account login'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'ParameterSetName': '--name --resource-group --debug'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'User-Agent': 'AZURECLI/2.69.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.8 (Linux-5.15.0-1068-azure-x86_64-with-glibc2.39)'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Authorization': '*****'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Request body:
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: This request has no body
28-Feb-2025 12:27:37	DEBUG: urllib3.connectionpool: Starting new HTTPS connection (1): management.usgovcloudapi.net:443
28-Feb-2025 12:27:37	DEBUG: urllib3.connectionpool: https://management.usgovcloudapi.net:443 "GET /subscriptions/FAKE_SUBSCRIPTION_GUID/resourceGroups/fakeGroup/providers/Microsoft.Batch/batchAccounts/fakeName?api-version=2024-02-01 HTTP/1.1" 200 None
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Response status: 200
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Response headers:
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Cache-Control': 'no-cache'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Pragma': 'no-cache'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Transfer-Encoding': 'chunked'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Content-Type': 'application/json; charset=utf-8'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Content-Encoding': 'gzip'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Expires': '-1'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Last-Modified': 'Sun, 29 Dec 2024 07:10:09 GMT'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'ETag': '"0x8DD27D7D4C2512A"'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Vary': 'Accept-Encoding'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'x-ms-request-id': '9ae44059-6b2b-4a8f-8685-2611cf1a0126'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'X-Content-Type-Options': 'nosniff'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Server': 'Kestrel'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'x-ms-ratelimit-remaining-subscription-reads': '14996'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'x-ms-correlation-request-id': '6190f570-33bc-4ada-8661-5059a5c4fbd7'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'x-ms-routing-request-id': 'USDODEAST:20250228T122737Z:6190f570-33bc-4ada-8661-5059a5c4fbd7'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies:     'Date': 'Fri, 28 Feb 2025 12:27:37 GMT'
28-Feb-2025 12:27:37	DEBUG: cli.azure.cli.core.sdk.policies: Response content:
--REDACTED--
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7fd085c43b00>, <function _x509_from_base64_to_hex_transform at 0x7fd085c43ba0>]
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: CommandInvoker.OnFilterResult []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: Cli.SuccessfulExecute []
28-Feb-2025 12:27:37	DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7fd085c03060>]
28-Feb-2025 12:27:37	INFO: az_command_data_logger: exit code: 0
28-Feb-2025 12:27:37	INFO: cli.__main__: Command ran in 0.654 seconds (init: 0.153, invoke: 0.501)
28-Feb-2025 12:27:37	INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
28-Feb-2025 12:27:37	INFO: telemetry.client: Accumulated 0 events. Flush the clients.
28-Feb-2025 12:27:37	INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
28-Feb-2025 12:27:37	INFO: telemetry.save: Save telemetry record of length 3846 in cache file under /var/obfuscated/path/.azure/telemetry/20250228122737912
28-Feb-2025 12:27:37	INFO: telemetry.main: Begin creating telemetry upload process.
28-Feb-2025 12:27:37	INFO: telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/__init__.py /var/obfuscated/path/.azure /var/obfuscated/path/.azure/telemetry/20250228122737912"
28-Feb-2025 12:27:37	INFO: telemetry.process: Return from creating process 414
28-Feb-2025 12:27:37	INFO: telemetry.main: Finish creating telemetry upload process.
28-Feb-2025 12:27:39	ERROR: AADSTS500011: The resource principal named https://batch.core.windows.net/ was not found in the tenant named DOJ. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant. Trace ID: 1de3f8fc-9591-4022-9dfe-f12052828700 Correlation ID: 6a8dd445-0876-4979-a8d9-2207b8f12a45 Timestamp: 2025-02-28 12:27:38Z
28-Feb-2025 12:27:39	Interactive authentication is needed. Please run:
28-Feb-2025 12:27:39	az login

Expected behavior

I should have a successful login to the azure batch account

Environment Summary

Output of az --version from cli that breaks

28-Feb-2025 12:27:31	azure-cli                         2.69.0
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	core                              2.69.0
28-Feb-2025 12:27:31	telemetry                          1.1.0
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	Dependencies:
28-Feb-2025 12:27:31	msal                            1.31.2b1
28-Feb-2025 12:27:31	azure-mgmt-resource               23.1.1
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	Python location '/opt/az/bin/python3'
28-Feb-2025 12:27:31	Config directory '/var/obfuscated/path/.azure'
28-Feb-2025 12:27:31	Extensions directory '/var/obfuscated/path/.azure/cliextensions'
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	Python (Linux) 3.12.8 (main, Feb  5 2025, 06:40:26) [GCC 13.3.0]
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	Legal docs and information: aka.ms/AzureCliLegal
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	
28-Feb-2025 12:27:31	Your CLI is up-to-date.

Output of az --version from cli that works

28-Feb-2025 12:05:03	WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
28-Feb-2025 12:05:03	azure-cli                         2.68.0 *
28-Feb-2025 12:05:03	
28-Feb-2025 12:05:03	core                              2.68.0 *
28-Feb-2025 12:05:03	telemetry                          1.1.0
28-Feb-2025 12:05:03	
28-Feb-2025 12:05:03	Dependencies:
28-Feb-2025 12:05:03	msal                              1.31.1
28-Feb-2025 12:05:03	azure-mgmt-resource               23.1.1
28-Feb-2025 12:05:03	
28-Feb-2025 12:05:03	Python location '/opt/az/bin/python3'
28-Feb-2025 12:05:03	Config directory '/var/obfuscated/path/.azure'
28-Feb-2025 12:05:03	Extensions directory '/var/obfuscated/path/.azure/cliextensions'

Additional context

This is in Azure US Government

Metadata

Metadata

Assignees

No one assigned

    Labels

    Auto-AssignAuto assign by botBatchaz batchService 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