-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[AzurePowerShell@2,3,4,5] [AzureFileCopy@2,3,4] [SqlAzureDacpacDeployment@1] Update Initialize-AzSubscription to use endpoint Environment in Connect-AzAccount to work with MSIs in AzureUSGov, ChinaCloud, etc. #14533
[AzurePowerShell@2,3,4,5] [AzureFileCopy@2,3,4] [SqlAzureDacpacDeployment@1] Update Initialize-AzSubscription to use endpoint Environment in Connect-AzAccount to work with MSIs in AzureUSGov, ChinaCloud, etc. #14533
Conversation
noting: it wasn't the Connect-AzAccount, it was the Set-AzContext; updated |
noting: Set-AzContext lacks an environment parameter |
More complicated than expected: the module responsible is not AzurePowerShell@5/initializeaz.ps1, it's InitializeAzModuleFunctions -> Set-CurrentAzureSubscription:
|
Is there a way we can gain additional traction on this issue? It is a major productivity enhancement for teams that need to support both public and gov clouds in the same enterprise solution. |
It looks like all comments are resolved. What do we need to get the merge? |
@cutecycle @AmrutaKawade - Are the corresponding automated tests updated for this change? |
I want to be sure about a few things;
I'm having some difficulty running tests myself; when I run
on Win10/powershell/node 14.15.1 I'm getting errors from a node dependency that's trying to use netcat to install an older node?
should I try in a linux container, or is there some additional setup outside of installing and running |
This is a short week for us due to local festivals. @AmrutaKawade will revert on this next week. |
|
I have updated integration tests for this change. |
it looks like the ci jobs got condition-skipped... is this okay? I'd expect some failures given some tasks are marked as 184 while we're on sprint 186 |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
Task name: AzurePowerShell@5
Description: pass the environment to Connect-AzAccount.
Documentation changes required: (Y/N) N
Added unit tests: (Y/N) N
Attached related issue: (Y/N) Y: #14176
Managed Identity Service Connection environment names are available in the VSTS serviceConnection API, but not passed to
Connect-AzAccount
inAzurePowerShell@V5
.Initialize-AzSubscription
passes the endpoint environment parameter only in the Service Principal branch of the elseif.In our case, This causes
RMProfileClient
to attempt to search for anAzureUSGovernment
subscription GUID inAzureCloud
by name and not find it:https://github.com/Azure/azure-powershell/blob/master/src/Accounts/Accounts/Models/RMProfileClient.cs#L352
I've added the
-Environment
parameter to Initialize-AzSubscription.Shouldn't Connect-AzAccount fail?
I thought so, so I tested the assumption and found that the MSI successfully connects to AzureCloud even if the self-hosted agent virtual machine is in an AzureUSGovernment subscription:
Specifying -Environment fixes this:
Checklist: