Skip to content

Commit 7e23ac3

Browse files
authored
Update error message on expired secrets (#291)
* Update error message for expired secrets * Bump npm package version
1 parent 06fb19d commit 7e23ac3

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

common-npm-packages/azure-arm-rest/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
"loc.messages.ResponseNotValid": "Response is not in a valid format",
164164
"loc.messages.NotAbleToCreateFirewallRule": "Getting error during adding firewall rule to Azure mysql server. Error: %s",
165165
"loc.messages.MethodNotImplementedError": "Method '%s' is not implemented.",
166-
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired. For more information refer https://aka.ms/azureappservicedeploytsg",
166+
"loc.messages.ExpiredServicePrincipal": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
167167
"loc.messages.CorrelationIdForARM": "Correlation ID from ARM api call response : %s",
168168
"loc.messages.CantDownloadAccessProfile": "Cannot download access profile/kube config file for the cluster %s. Reason %s.",
169169
"loc.messages.FailedToPatchAppServiceConfiguration": "Failed to patch App Service '%s' configuration. Error: %s",

common-npm-packages/azure-arm-rest/azure-arm-common.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,15 @@ export class ApplicationTokenCredentials {
492492
}
493493

494494
if (error.errorMessage && error.errorMessage.toString().startsWith("7000222")) {
495-
// additional error message when clientSecret has been expired
496-
tl.error(tl.loc('ExpiredServicePrincipal'));
497-
}
495+
// Additional error message when clientSecret has been expired
496+
const organizationURL = tl.getVariable('System.CollectionUri');
497+
const projectName = tl.getVariable('System.TeamProject');
498+
const serviceConnectionLink = encodeURI(`${organizationURL}${projectName}/_settings/adminservices?resourceId=${this.connectedServiceName}`);
498499

499-
throw new Error(tl.loc('CouldNotFetchAccessTokenforAzureStatusCode', error.errorCode, error.errorMessage));
500+
throw new Error(tl.loc('ExpiredServicePrincipal', serviceConnectionLink));
501+
} else {
502+
throw new Error(tl.loc('CouldNotFetchAccessTokenforAzureStatusCode', error.errorCode, error.errorMessage));
503+
}
500504
}
501505
}
502506

common-npm-packages/azure-arm-rest/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
"ResponseNotValid": "Response is not in a valid format",
164164
"NotAbleToCreateFirewallRule": "Getting error during adding firewall rule to Azure mysql server. Error: %s",
165165
"MethodNotImplementedError": "Method '%s' is not implemented.",
166-
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired. For more information refer https://aka.ms/azureappservicedeploytsg",
166+
"ExpiredServicePrincipal": "Secret expired, update service connection at %s See https://aka.ms/azdo-rm-workload-identity-conversion to learn more about conversion to secret-less service connections.",
167167
"CorrelationIdForARM" : "Correlation ID from ARM api call response : %s",
168168
"Successfullyupdateddeploymenthistory": "Successfully updated deployment History at %s",
169169
"Failedtoupdatedeploymenthistory": "Failed to update deployment history. Error: %s",

common-npm-packages/azure-arm-rest/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common-npm-packages/azure-arm-rest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-pipelines-tasks-azure-arm-rest",
3-
"version": "3.235.0",
3+
"version": "3.236.0",
44
"description": "Common Lib for Azure ARM REST apis",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)