@@ -120,10 +120,10 @@ export class azureclitask {
120120 //set the azure mode to arm to use azureRM commands
121121 this . throwIfError ( tl . execSync ( "azure" , "config mode arm" ) ) ;
122122 //login using svn
123- this . throwIfError ( tl . execSync ( "azure" , "login -u " + servicePrincipalId + " -p " + servicePrincipalKey + " --tenant " + tenantId + " --service-principal" ) ) ;
123+ this . throwIfError ( tl . execSync ( "azure" , "login -u \"" + servicePrincipalId + "\" -p \"" + servicePrincipalKey + "\" --tenant \"" + tenantId + "\ " --service-principal") ) ;
124124 this . isLoggedIn = true ;
125125 //set the subscription imported to the current subscription
126- this . throwIfError ( tl . execSync ( "azure" , "account set " + subscriptionName ) ) ;
126+ this . throwIfError ( tl . execSync ( "azure" , "account set \"" + subscriptionName + "\"" ) ) ;
127127 }
128128
129129 private static loginAzureClassic ( connectedService ) :void {
@@ -136,20 +136,20 @@ export class azureclitask {
136136 var subscriptionId :string = tl . getEndpointDataParameter ( connectedService , "SubscriptionId" , true ) ;
137137 const publishSettingFileName :string = path . join ( os . tmpdir ( ) , "subscriptions" + new Date ( ) . getTime ( ) + ".publishsettings" ) ;
138138 this . createPublishSettingFile ( subscriptionName , subscriptionId , bytes , publishSettingFileName ) ;
139- var resultOfToolExecution = tl . execSync ( "azure" , "account import " + publishSettingFileName ) ;
139+ var resultOfToolExecution = tl . execSync ( "azure" , "account import \"" + publishSettingFileName + "\"" ) ;
140140 this . deleteFile ( publishSettingFileName ) ;
141141 this . throwIfError ( resultOfToolExecution ) ;
142142 this . isLoggedIn = true ;
143143 //set the subscription imported to the current subscription
144- this . throwIfError ( tl . execSync ( "azure" , "account set " + subscriptionName ) ) ;
144+ this . throwIfError ( tl . execSync ( "azure" , "account set \"" + subscriptionName + "\"" ) ) ;
145145 }
146146 else if ( endpointAuth . scheme === "UsernamePassword" ) {
147147 var username :string = endpointAuth . parameters [ "username" ] ;
148148 var passwd :string = endpointAuth . parameters [ "password" ] ;
149- this . throwIfError ( tl . execSync ( "azure" , "login -u " + username + " -p " + passwd ) ) ;
149+ this . throwIfError ( tl . execSync ( "azure" , "login -u \"" + username + "\" -p \"" + passwd + "\"" ) ) ;
150150 this . isLoggedIn = true ;
151151 //set the subscription imported to the current subscription
152- this . throwIfError ( tl . execSync ( "azure" , "account set " + subscriptionName ) ) ;
152+ this . throwIfError ( tl . execSync ( "azure" , "account set \"" + subscriptionName + "\"" ) ) ;
153153 }
154154 else {
155155 var err ;
@@ -179,7 +179,7 @@ export class azureclitask {
179179 private static logoutAzureRM ( connectedService :string )
180180 {
181181 var subscriptionName :string = tl . getEndpointDataParameter ( connectedService , "SubscriptionName" , true ) ;
182- tl . execSync ( "azure" , " account clear -s " + subscriptionName ) ;
182+ tl . execSync ( "azure" , " account clear -s \"" + subscriptionName + "\"" ) ;
183183 }
184184
185185 private static logoutAzureClassic ( connectedService :string )
@@ -188,11 +188,11 @@ export class azureclitask {
188188 if ( endpointAuth [ "scheme" ] === "usernamePassword" )
189189 {
190190 var username :string = endpointAuth . parameters [ "username" ] ;
191- tl . execSync ( "azure" , "logout -u " + username ) ;
191+ tl . execSync ( "azure" , "logout -u \"" + username + "\"" ) ;
192192 }
193193 else {
194194 var subscriptionName :string = tl . getEndpointDataParameter ( connectedService , "SubscriptionName" , true ) ;
195- tl . execSync ( "azure" , " account clear -s " + subscriptionName ) ;
195+ tl . execSync ( "azure" , " account clear -s \"" + subscriptionName + "\"" ) ;
196196 }
197197 }
198198
0 commit comments