Hello,
I have following PS script. Testing for the first time. Bit new to Azure. When I run this I am seeing the error message shown below. Will greatly appreciate your help at the earliest. I am testing from inside a Azure VM (Win2k19 OS) and not from Azure portal.
param($TimerBlob)
$CleanupTime = [DateTime]::UtcNow.AddHours(-168)
$context = New-AzStorageContext -StorageAccountName "dailysqlbackup" -StorageAccountKey "<Access Key of the storage account>"
Get-AzStorageBlob -Container "dbbackups" -Context $context |
Where-Object { $_.LastModified.UtcDateTime -lt $CleanupTime -and $_.BlobType -eq "PageBlob" -and $_.Name -like "*.bak"} |
Remove-AzStorageBlob
Get-AzStorageBlob : Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. HTTP Status Code: 403 - HTTP
Error Message: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
ErrorCode: AuthenticationFailed
ErrorMessage: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId: d4a0417a-e01e-0018-77f9-d522d5000000
Time: Wed, 23 Aug 2023 14:39:22 GMT
At line:6 char:1
+ Get-AzStorageBlob -Container "dbbackups" -Context $context |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzStorageBlob], StorageException
+ FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageBlobCommand