PR to include support for Sovereign cloud in azlogin action - #85
Conversation
|
Zainudeen V K (@zainuvk) is azure powershell login handled for sovereign cloud support? Currently in azure powershell login in sovereign cloud branch, environment is set only for azurestack Reference - https://github.com/Azure/login/blob/azuresovereigncloud/src/PowerShell/Utilities/ScriptBuilder.ts#L12 |
Zainudeen V K (zainuvk)
left a comment
There was a problem hiding this comment.
aksm-ms From the document available
This is what that is documented:
When you start PowerShell, you have to tell Azure PowerShell to connect to Azure Government by specifying an environment parameter. The parameter ensures that PowerShell is connecting to the correct endpoints. The collection of endpoints is determined when you connect log in to your account. Different APIs require different versions of the environment switch:
| Connection type | Command |
|---|---|
| Azure commands | Connect-AzAccount -EnvironmentName AzureUSGovernment |
The code in getAzPSLoginScript would set Environment variable passed in command and then execute the same.
let command = Clear-AzContext -Scope Process; Clear-AzContext -Scope CurrentUser -Force -ErrorAction SilentlyContinue;;
if (scheme === Constants.ServicePrincipal) {
if (args.environment.toLowerCase() == "azurestack") {
command += Add-AzEnvironment -Name ${args.environment} -ARMEndpoint ${args.resourceManagerEndpointUrl} | out-null;;
}
command += Connect-AzAccount -ServicePrincipal -Tenant '${tenantId}' -Credential \ (New-Object System.Management.Automation.PSCredential('${args.servicePrincipalId}',(ConvertTo-SecureString '${args.servicePrincipalKey.replace("'", "''")}' -AsPlainText -Force))) \ -Environment '${args.environment}' | out-null;;
if (args.scopeLevel === Constants.Subscription) {
command += Set-AzContext -SubscriptionId '${args.subscriptionId}' -TenantId '${tenantId}' | out-null;;
}
}
This workflow infact test both az cli and az powershell for various combination of input to azlogin https://github.com/Azure/azure-actions-integration-tests/blob/master/.github/workflows/azlogin_test.yml
Please feel free to let me know if you see any issues here or if my understanding is incorrect.
| @@ -0,0 +1,7 @@ | |||
| export enum AzureCloudName { | |||
There was a problem hiding this comment.
PowerShell folder has code changes related to Azure Powershell login. Sovereign cloud changes should be made in both az cli login and powershell login, hence please move it outside.
|
Please update the PR title. |
| } | ||
|
|
||
| // Attempting Az cli login | ||
| if (environment.toLowerCase() == "azurestack") { |
There was a problem hiding this comment.
move this entire if block in a separate method like RegisterAzureStackEnvironment()
There was a problem hiding this comment.
Ashish Ranjan (@asranja) since this is an existing code of Azure stack I am not very comfortable on touching stack code.And for that reason we branched out separately for Soverign cloud. There is a separate branch for stack changes and this can be done there.
| } | ||
| let suffixKeyvault = ".vault" + baseUri.substring(baseUri.indexOf('.')); // keyvault suffix starts with . | ||
| let suffixStorage = baseUri.substring(baseUri.indexOf('.')+1); // storage suffix starts without . | ||
| let profileVersion = "2019-03-01-hybrid"; |
There was a problem hiding this comment.
make this a global constant like
const AZURE_STACK_PROFILE_VERSION = "2019-03-01-hybrid"
The PR is to include support for Azure Gov Cloud. The details are listed in ADR doc:
https://github.com/github/Microsoft-Attach/blob/users/zainudv/actionsazuregovcloud/adrs/azure-integration/GitHubAction_AzureGovCloudIntegration.md
We took the #4 approach mentioned in ADR to align with Azure stack