login action for azurestack (#41)

* login action for azurestack

* test update for azurestack

* review changes

* review changes v2

* review changes v3
This commit is contained in:
Rakesh Kumar
2020-08-27 20:48:43 -07:00
committed by GitHub
parent 91da0d4635
commit 513cdfa020
5 changed files with 46 additions and 6 deletions

View File

@@ -9,6 +9,9 @@ export default class ScriptBuilder {
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;`;