0

enter image description here enter image description here

Getting Error while calling Remove-AzureStorageBlob Powershell

Remove-AzureStorageBlob -Container $ConName -Blob $BlobName -Context $Ctx
Remove-AzureStorageBlob : Method not found: 'Void
Microsoft.WindowsAzure.Storage.OperationContext.set_StartTime(System.DateTime)'.
At line:1 char:1
+ Remove-AzureStorageBlob -Container $ConName -Blob $BlobName -Context  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Remove-AzureStorageBlob], StorageException
    + FullyQualifiedErrorId : StorageException,Microsoft.WindowsAzure.Commands.Storage.Blob.RemoveStorageAzureBlobComm
   and
2

2 Answers 2

4

Your commands belong to the AzureRM powershell module. According to the error message, you may not install it, I can reproduce your issue on my side.

enter image description here

To fix the issue, follow this doc to install AzureRM powershell module, then it will work fine : https://learn.microsoft.com/en-us/powershell/azure/azurerm/install-azurerm-ps?view=azurermps-6.13.0

Besides, the AzureRM module has been deprecated basically, I recommand you to use the new Az module. For more details, see : https://azure.microsoft.com/en-us/blog/azure-powershell-cross-platform-az-module-replacing-azurerm/ and https://learn.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-1.2.0.

Sign up to request clarification or add additional context in comments.

1 Comment

Finally the following helped 1. Uninstall Azure Powershell MSI 2. Use custom powershell script to uninstall-AllModules of AzureRM 3. Install Az Module Now the issue is resolved. @JoyWang - Accepting your answer now. Thanks for your help
1

Remove-AzureStorageBlob is part of the deprecated module AzureRM. The same method in a now module Az has now the name Remove-AzStorageBlob. THis fact is not so well documented and it took me a while to find it out.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.