Skip to content

Commit 3886877

Browse files
simonasaittaSimona SaittaPavloAndriiesh
authored
AzureKeyVault task - Fix keyvault name format (#16523) (#16570)
* Add error message in case of invalid key vault name * bump version Co-authored-by: Simona Saitta <[email protected]> Co-authored-by: Pavlo Andriiesh <[email protected]>
1 parent 5e7bb73 commit 3886877

File tree

5 files changed

+15
-352
lines changed

5 files changed

+15
-352
lines changed

Tasks/AzureKeyVaultV2/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@
4646
"loc.messages.CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode": "Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: %s, status message: %s",
4747
"loc.messages.CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
4848
"loc.messages.RetryingWithVaultResourceIdFromResponse": "Retrying with vault resource Id reterieved from response : %s",
49-
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
49+
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
50+
"loc.messages.InvalidKeyVaultName": "%s is an invalid KeyVault name."
5051
}

Tasks/AzureKeyVaultV2/models/KeyVaultTaskParameters.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export class KeyVaultTaskParameters {
2323
var connectedService = tl.getInput("ConnectedServiceName", true);
2424
this.subscriptionId = tl.getEndpointDataParameter(connectedService, "SubscriptionId", true);
2525
this.keyVaultName = tl.getInput("KeyVaultName", true);
26+
if (this.keyVaultName != encodeURIComponent(this.keyVaultName)){
27+
throw new Error(tl.loc("InvalidKeyVaultName", this.keyVaultName));
28+
}
2629
this.secretsFilter = tl.getDelimitedInput("SecretsFilter", ",", true);
2730
var azureKeyVaultDnsSuffix = tl.getEndpointDataParameter(connectedService, "AzureKeyVaultDnsSuffix", true);
2831
if (!azureKeyVaultDnsSuffix) {

Tasks/AzureKeyVaultV2/npm-shrinkwrap.json

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

Tasks/AzureKeyVaultV2/task.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"author": "Microsoft Corporation",
1515
"version": {
1616
"Major": 2,
17-
"Minor": 200,
17+
"Minor": 207,
1818
"Patch": 0
1919
},
2020
"demands": [],
@@ -118,6 +118,7 @@
118118
"CouldNotFetchAccessTokenforMSIDueToMSINotConfiguredProperlyStatusCode": "Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: %s, status message: %s",
119119
"CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
120120
"RetryingWithVaultResourceIdFromResponse": "Retrying with vault resource Id reterieved from response : %s",
121-
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
121+
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
122+
"InvalidKeyVaultName": "%s is an invalid KeyVault name."
122123
}
123124
}

0 commit comments

Comments
 (0)