[英]Failed to delete storage account in portal.azure.com
I deleted a Virtual Machine and its associated cloud service and virtual network but I can't delete its storage account. 我删除了虚拟机及其关联的云服务和虚拟网络,但我无法删除其存储帐户。
I got this error: 我收到了这个错误:
Failed to delete storage account messega.
无法删除存储帐户messega。 Unable to delete storage account 'messega':
无法删除存储帐户'messega':
'Storage account messega has some active image(s) and/or disk(s), eg messega-messega-os-1449504882530.
'存储帐户messega有一些活动图像和/或磁盘,例如messega-messega-os-1449504882530。 Ensure these image(s) and/or disk(s) are removed before deleting this storage account.'.
在删除此存储帐户之前,请确保删除这些映像和/或磁盘。'。
I went to Storage accounts (classic)>>Services--Blobs>>Containers--vhds and tried to delete the storage container 'vhds': messega-messega-os-1449504882530 but I got this new error: 我去了存储帐户(经典)>>服务 - Blob >>容器 - vhds并试图删除存储容器'vhds':messega-messega-os-1449504882530但我收到了这个新错误:
Failed to delete storage container 'vhds'.
无法删除存储容器'vhds'。 Error: 'There is currently a lease on the container and no lease ID was specified in the request.'
错误:'当前存在容器租约,并且未在请求中指定租约ID。
删除磁盘可以通过以前版本的门户网站manage.windowsazure.com虚拟机 - >磁盘完成
It's a common error. 这是一个常见的错误。 Your vhd is in this storage account, that's why you can't remove it, without delete the vhd.
您的vhd在此存储帐户中,这就是为什么在不删除vhd的情况下无法将其删除的原因。
https://stackoverflow.com/a/10969013/1384539 https://stackoverflow.com/a/10969013/1384539
If lease on your .vhd keeps annoying you, you may use a tool than enables to break the lease such as Azure Management Studio or use code to break it : 如果您的.vhd上的租约一直让您烦恼,那么您可以使用一个工具而不是启用来破坏租约,例如Azure Management Studio或使用代码来破坏它:
var azureStorageConnectionString = ConfigurationManager.AppSettings["AzureStorage.ConnectionString"];
var blobFileToDelete= ConfigurationManager.AppSettings["BlobFileToDelete.Name"];
var account = CloudStorageAccount.Parse(azureStorageConnectionString);
// Create the blob client using the Accounts above
var client = account.CreateCloudBlobClient();
// Retrieve reference to a previously created container
// Rename "vhds" as needed. Can be used to read from any container.
var container = client.GetContainerReference("vhds");
var blob = container.GetBlockBlobReference(blobFileToDelete);
if (blob.Properties.LeaseStatus==Microsoft.WindowsAzure.Storage.Blob.LeaseStatus.Locked)
{
try
{
Console.WriteLine("Breaking leases on {0} blob.",blobFileToDelete);
// Create Timespan to allow the Lease to remain, in this case 1 second
TimeSpan breakTime = new TimeSpan(0, 0, 1);
blob.BreakLease(breakTime, null, null, null);
Console.WriteLine("Successfully broken lease on {0} blob.",blobFileToDelete);
}
catch (StorageException ex )
{
Console.WriteLine(ex.Message);
Console.WriteLine("Failed to break lease on {blobName} blob.", blobFileToDelete);
}
}
else
{
Console.WriteLine("The {0} blob's lease status is unlocked.", blobFileToDelete);
}
Console.ReadLine();
Hopes this helps Best regards Stéphane 希望这有助于最好的问候Stéphane
您需要使用Azure存储资源管理器工具,并在大多数情况下检查容器的内容是否为空
I tried all these things with no luck. 我没有运气就尝试了所有这些事情。 The answer for me was to download http://storageexplorer.com/ and from this tool I was able to delete the necessary files.
我的答案是下载http://storageexplorer.com/ ,从这个工具我能够删除必要的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.