Skip to content

Commit

Permalink
AzureKeyVault task - Fix keyvault name format (#16523) (#16570)
Browse files Browse the repository at this point in the history
* Add error message in case of invalid key vault name
* bump version

Co-authored-by: Simona Saitta <simonasaitta@microsoft.com>
Co-authored-by: Pavlo Andriiesh <pavlo.andriiesh@gmail.com>
  • Loading branch information
3 people authored Jul 11, 2022
1 parent 5e7bb73 commit 3886877
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 352 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@
"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",
"loc.messages.CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
"loc.messages.RetryingWithVaultResourceIdFromResponse": "Retrying with vault resource Id reterieved from response : %s",
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
"loc.messages.ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
"loc.messages.InvalidKeyVaultName": "%s is an invalid KeyVault name."
}
3 changes: 3 additions & 0 deletions Tasks/AzureKeyVaultV2/models/KeyVaultTaskParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class KeyVaultTaskParameters {
var connectedService = tl.getInput("ConnectedServiceName", true);
this.subscriptionId = tl.getEndpointDataParameter(connectedService, "SubscriptionId", true);
this.keyVaultName = tl.getInput("KeyVaultName", true);
if (this.keyVaultName != encodeURIComponent(this.keyVaultName)){
throw new Error(tl.loc("InvalidKeyVaultName", this.keyVaultName));
}
this.secretsFilter = tl.getDelimitedInput("SecretsFilter", ",", true);
var azureKeyVaultDnsSuffix = tl.getEndpointDataParameter(connectedService, "AzureKeyVaultDnsSuffix", true);
if (!azureKeyVaultDnsSuffix) {
Expand Down
345 changes: 1 addition & 344 deletions Tasks/AzureKeyVaultV2/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Tasks/AzureKeyVaultV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 200,
"Minor": 207,
"Patch": 0
},
"demands": [],
Expand Down Expand Up @@ -118,6 +118,7 @@
"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",
"CouldNotFetchAccessTokenforMSIStatusCode": "Could not fetch access token for Managed Service Principal. Status code: %s, status message: %s",
"RetryingWithVaultResourceIdFromResponse": "Retrying with vault resource Id reterieved from response : %s",
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired."
"ExpiredServicePrincipal": "Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.",
"InvalidKeyVaultName": "%s is an invalid KeyVault name."
}
}
Loading

0 comments on commit 3886877

Please sign in to comment.