Skip to content

Multitenant serviceprincipal fails to change context in Az.Accounts version 2.10.4 #20484

@lassehastrup

Description

@lassehastrup

Description

After Az.Accounts was updated to version 2.10.4 we can no longer change AzContext or generate a Access Token with a multi-tenant App registration.

Connect-AzAccount -TenantId (Tenant1 where the app registration is created) - this works OK.

Set-AzContext -TenantId (Tenant2 where the app registration is linked and registered as an Enterprise App) - We receive error.

Error: ##[error]The running command stopped because the preference variable "WarningPreference" or common parameter is set to Stop: Unable to acquire token for tenant 'XYZ' with error 'No certificate thumbprint or secret provided for the given service principal '***'.'

This is tested and worked in Az.Accounts version 2.10.0 - 2.10.3, and this is critical, as the way the import of Az.Accounts works is difficult to handle. Even though we specify an older version of
AzurePowershell
azurePowerShellVersion: OtherVersion
preferredAzurePowerShellVersion: 9.1.1 (tested with 8.3.0 and 9.1.0)

The Az will still import the latest version of Az.Accounts which has this error.

Issue script & Debug output

Connect-AzAccount -Tenant (Tenant1 where the app registration is created) -Credential $creds -ServicePrincipal- this works OK.

Set-AzContext -TenantId (Tenant2 where the app registration is registered as an Enterprise App) - We receive error.

Environment data

This is tested and working in Az.Accounts version 2.10.0 - 2.10.3

Module versions

Az.Accounts version 2.10.4

Error output

Error: ##[error]The running command stopped because the preference variable "WarningPreference" or common parameter is set to Stop: Unable to acquire token for tenant 'XYZ' with error 'No certificate thumbprint or secret provided for the given service principal '***'.'

Metadata

Metadata

Assignees

Labels

AccountsIssues in Az.Accounts except authentication relatedAuthenticationAzure PS TeamTrackingWe will track status and follow internallybugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reported

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions