Description
- Package Name: azure/storage-blob
- Package Version: 12.23.0-beta.1
- Operating system: windows
- nodejs
- version: 20.18.0
- browser
- name/version: Chrome , Edge
- typescript
- version:
Describe the bug
Hi , I am trying to deploy an ARM template stored in storage account by generating a URL . I am following this guide to generate URL - https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deploy-to-azure-button#template-stored-in-azure-storage-account
But I am facing intermitent issues while deploying the template . Sometimes it works but sometimes it fails. We have tested it on multilple machines .We receive the following error.
If we open the URL in above screenshot , in a browser . we see this error -
RestError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
AuthenticationFailed
Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:03824724-601e-0041-2825-1f9ee4000000 Time:2024-10-15T17:13:39.3694765Z
Signature fields not well formed.
To Reproduce
Steps to reproduce the behavior:
- shared sample code
Expected behavior
The upload template should work each time.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Sharing the code for reference -
We see this intermitent issue in line number 18 and line 22
- const sasToken = generateBlobSASQueryParameters(
-
{
-
containerName,
-
permissions: BlobSASPermissions.parse("racwd"),
-
expiresOn: new Date(new Date().valueOf() + 86400),
-
},
-
sharedKeyCredential
-
).toString();
-
let sasUrls: string[] = [];
-
try {
-
for (let i = 0; i < templates.length; i++) {
-
const blobName = utils.generateTemplatePath(this.migrationStateModel, this._targetType, i + 1);
-
var sasUrl = `https://${accountName}.blob.core.windows.net/${containerName}/${blobName}?${sasToken}`;
-
sasUrls.push(sasUrl);
-
const blockBlobClient = new BlockBlobClient(sasUrl);
-
await blockBlobClient.upload(templates[i], templates[i].length);
-
}
-
for (let i = 0; i < sasUrls.length; i++) {
-
let deployToAzureUrl = 'https://portal.azure.com/#create/Microsoft.Template/uri/' + encodeURIComponent(sasUrls[i]); exec(`${opener} ${deployToAzureUrl}`); }
-
}