You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Tenant above is not guest tenant my account is member of, it's not my home tenant. Since this is default context the rest of steps are failing as a result.
EPAC Version
10.6.0
The text was updated successfully, but these errors were encountered:
This shall be Get-AzSubscription | Where-Object TenantId -eq $TenantId | Select-Object -First 1 | Set-AzContext , s
In my case, I have access to the same subscription through 2 different tenants and based on original code first one is chosen which is incorrect selection since subscription is in different tenant compared to AzContext
PS C:\repo\azure-policies-infra> Get-AzSubscription | where name -eq "InfoSec Subscription - Production" | select name, HomeTenantId, tenantid
Name HomeTenantId TenantId
---- ------------ --------
InfoSec Subscription - Production 79c33897-92ad-8c26b93e2199 692216d6-afb6-53159e46b17f
InfoSec Subscription - Production 79c33897-92ad-8c26b93e2199 79c33897-92ad-8c26b93e2199
Does using defaultContext in the global-settings.jsonc file help with this?
defaultContext: In rare cases (typically only when deploying to a lighthouse managed tenant) the default context (Get-azContext) of a user/SPN running a plan will
be set to a subscription where that user/SPN does not have sufficient privileges. Some checks have been built in so that in some cases when this happens EPAC is able to fix the context issue. When it is not, a defaultContext subscription name must be provided. This can be any subscription within the deploymentRootScope.
Describe the bug
Default context is not properly chosen again if account is guest account to several tenants
To Reproduce
Make sure your Azure account is guest in another tenant and run BuildDeployment-Plan
Expected behavior
Shall work
Screenshots
PS C:\repo\azure-policies-infra> get-azContext | fl
This Tenant above is not guest tenant my account is member of, it's not my home tenant. Since this is default context the rest of steps are failing as a result.
EPAC Version
10.6.0
The text was updated successfully, but these errors were encountered: