azure-pipelines-tasks-azurermdeploycommon 3.221.0 → 3.221.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -141,17 +141,24 @@ class AzureAppServiceUtility {
141
141
  getKuduAuthHeader(publishingCredentials) {
142
142
  return __awaiter(this, void 0, void 0, function* () {
143
143
  const scmPolicyCheck = yield this.isSitePublishingCredentialsEnabled();
144
- if (!scmPolicyCheck) {
145
- const accessToken = yield this._appService._client.getCredentials().getToken();
146
- tl.debug("Kudu: using bearer token.");
147
- return "Bearer " + accessToken;
144
+ let token = "";
145
+ let method = "";
146
+ if (scmPolicyCheck === false) {
147
+ token = yield this._appService._client.getCredentials().getToken();
148
+ method = "Bearer";
148
149
  }
149
- const password = publishingCredentials.properties["publishingPassword"];
150
- const userName = publishingCredentials.properties["publishingUserName"];
151
- tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, password, true);
152
- tl.debug("Kudu: using basic auth.");
153
- const auth = (new Buffer(userName + ':' + password).toString('base64'));
154
- return "Basic " + auth;
150
+ else {
151
+ tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, publishingCredentials.properties["publishingPassword"], true);
152
+ const buffer = new Buffer(publishingCredentials.properties["publishingUserName"] + ':' + publishingCredentials.properties["publishingPassword"]);
153
+ token = buffer.toString('base64');
154
+ method = "Basic";
155
+ }
156
+ const authMethodtelemetry = {
157
+ authMethod: method
158
+ };
159
+ tl.debug(`Using ${method} authentication method for Kudu service.`);
160
+ console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureAppServiceDeployment]" + JSON.stringify(authMethodtelemetry));
161
+ return method + " " + token;
155
162
  });
156
163
  }
157
164
  getPhysicalPath(virtualApplication) {
@@ -301,8 +308,8 @@ class AzureAppServiceUtility {
301
308
  }
302
309
  }
303
310
  catch (error) {
304
- tl.debug(`Skipping SCM Policy check: ${error}`);
305
- return null;
311
+ tl.debug(`Call to get SCM Policy check failed: ${error}`);
312
+ return false;
306
313
  }
307
314
  });
308
315
  }
@@ -134,20 +134,26 @@ export class AzureAppServiceUtility {
134
134
  private async getKuduAuthHeader(publishingCredentials: any): Promise<string> {
135
135
  const scmPolicyCheck = await this.isSitePublishingCredentialsEnabled();
136
136
 
137
- if (!scmPolicyCheck) {
138
- const accessToken = await this._appService._client.getCredentials().getToken();
139
- tl.debug("Kudu: using bearer token.");
140
- return "Bearer " + accessToken;
137
+ let token = "";
138
+ let method = "";
139
+
140
+ if(scmPolicyCheck === false) {
141
+ token = await this._appService._client.getCredentials().getToken();
142
+ method = "Bearer";
143
+ } else {
144
+ tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, publishingCredentials.properties["publishingPassword"], true);
145
+ const buffer = new Buffer(publishingCredentials.properties["publishingUserName"] + ':' + publishingCredentials.properties["publishingPassword"]);
146
+ token = buffer.toString('base64');
147
+ method = "Basic";
141
148
  }
142
149
 
143
- const password = publishingCredentials.properties["publishingPassword"];
144
- const userName = publishingCredentials.properties["publishingUserName"];
150
+ const authMethodtelemetry = {
151
+ authMethod: method
152
+ };
153
+ tl.debug(`Using ${method} authentication method for Kudu service.`);
154
+ console.log("##vso[telemetry.publish area=TaskDeploymentMethod;feature=AzureAppServiceDeployment]" + JSON.stringify(authMethodtelemetry));
145
155
 
146
- tl.setVariable(`AZURE_APP_SERVICE_KUDU_${this._appService.getSlot()}_PASSWORD`, password, true);
147
- tl.debug("Kudu: using basic auth.");
148
-
149
- const auth = (new Buffer(userName + ':' + password).toString('base64'));
150
- return "Basic " + auth;
156
+ return method + " " + token;
151
157
  }
152
158
 
153
159
  public async getPhysicalPath(virtualApplication: string): Promise<string> {
@@ -309,8 +315,8 @@ export class AzureAppServiceUtility {
309
315
  }
310
316
  }
311
317
  catch(error){
312
- tl.debug(`Skipping SCM Policy check: ${error}`);
313
- return null;
318
+ tl.debug(`Call to get SCM Policy check failed: ${error}`);
319
+ return false;
314
320
  }
315
321
  }
316
322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azure-pipelines-tasks-azurermdeploycommon",
3
- "version": "3.221.0",
3
+ "version": "3.221.2",
4
4
  "description": "Common Lib for Azure ARM REST apis",
5
5
  "repository": {
6
6
  "type": "git",