问题
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
回答1:
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.
To fix the issue, follow this doc to install AzureRM
powershell module, then it will work fine : https://docs.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://docs.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-1.2.0.
来源:https://stackoverflow.com/questions/54615806/powershell-error-remove-azurestorageblob-method-not-found-void