How can I delete a leased blob in Microsoft Azure storage - azure

I created a virtual machine in Azure and then deleted it.
However, the associated storage account still exists.
I can't delete the storage account because it contains a container with a blob in it that has an indefinite lease.
Nothing else is using this storage account.
How can I delete this blob?

You need to delete the disk objects that are associated with the abandoned vhd's. You can do this easily in either the classic or new portal. Once you dispose of these (along with associated leases), you should be able to get rid of your storage account
In the Classic portal (manage.windowsazure.com), you just visit Virtual Machines, then Disks. Select a disk to delete, and click the trash can at the bottom of the screen.
In the new portal (portal.azure.com) you'll find the disks under OS Disks (classic) :
From there, you can select and delete the disks from the VM's you deleted.

You can Use Azure Cloud Explorer tool on Codeplex Open the Storage Account Delete all files inside that container,
Then you Can Delete the Container and the Storage Account Easily

One solution is to delete the container, whether through a GUI like a cloud explorer, tooling like Azure Storage Powershell, or using the rest API with an Azure Storage Client Library.
You don't need the blob lease to delete the container, which would also delete any blobs present in the container.

Related

How to know Storage Account is associated with Azure VM or HDInsight Cluster

I have create more than 3 storage account and 3 VM and 3 Clusters.
Storage Accounts:
Storage Account 1
Storage Account 2
Storage Account 3
I want to know Storage Account 1 is associated with how many VM and Clusters. How can I find it via Azure Portal ?
A storage account isn't an "owned" or "dedicated" resource. That is, even if you use a storage account for a given app or service, there's no tight coupling between the two. Any service / app that has your account credentials (or a SAS link to a specific container/queue/table within your storage account) will be able to use that storage account.
However, if you look at the settings for a given app or service (in your case, your VM or HDInsight), you can see which storage accounts it's using, with a bit of digging. For example, your VM might have both OS and Data disks, with each disk using potentially a different storage account - you'd need to enumerate the OS+attached disks to see which storage accounts are in use for each.
Further, if you create all resources at once (again, imagine creating a new VM with new storage), all of your resources will be bundled together within the same Resource Group.
You can via the new Azure portal to find the Azure Storage Account, in the storage account, you will find the Container. The vhds container used for Azure VM by default, select the vhds, you will find the VMs' VHD files there. About the HDInsight, the default Container name is the HDInsight name, so we can find the result manually.

Azure VM two storages

I'm using Azure VM (Ubuntu 16.04) as web server. For some reason at my resource group for VM there are two storages.
First - GRS Standart and second LRS Premium.
How to determine which storage is necessary for my web server and which I can safely delete?
You can check the storage account holding the disks (OS and Data disks) by clicking on Disks option and then clicking on individual disks. You will see the URL of the page blob holding the disk and that should tell you about the storage account.
However before deleting the other storage account, please check if it is not used for collecting diagnostics data for the VM.
Making an assumption, I believe your LRS Premium account is holding the disks and the other one is for storing diagnostics data.

Perform Azure Storage operations from VHD within same Storage account

When working with a VHD hosted within an Azure Storage account, are there any operations one can perform to access the Storage account directly?
I.e. I create a VM and store it's VHD in a blob in account A, are there any local/efficient ways to work with data in account A from the VM?
See if Azure Storage Files service will work for you. You may attach your storage as a file share and communicate with that directly using traditional APIs.
Apart of that, you may use cross-platform Azure Storage Explorer for communicating with other Storage subservices like Blobs.

Can you copy an Azure VM from one account to another account?

We created a VM for a client and set it all up on our account. A bunch of work. Now I'd like to put a copy of it on his Azure account (which he does not have yet) and keep my copy for troubleshooting. Is there a method I can use to backup the VM and restore it to his Azure account? Or any other suggested way to copy it to another account's VM?
Sure you can. Since VHD for your Virtual Machine is stored as Page Blob in Azure Storage, you can simply copy the blob from one storage account to another. You can use AzCopy tool to do that. There's no need for you to download the blob from main storage account and reupload it in backup storage account.
When you need to create a VM again, simply create an image using that blob and then create a VM from that image.
You can create Image and upload to the new account, You can check link for more information Create and upload a Windows Server VHD to Azure

Azure Orphan Storage Account

I mistakenly created a VM without linking it to an extant storage account. When I realized my mistake I deleted the VM and then sought to delete the storage account. I found the auto created storage account and attempted to remove the container. However even 24 hours later I get told that the container contains resources in use by the (now deleted) VM and so cannot be deleted.
Clearly there is some kind of dependency which is not apparent from the management portal which needs to be removed. I am looking for some advice on a powershell approach to investigating and resolving this issue.
You have to disassociate the disk with the VM image (VHD) before you can delete the blob or container.
You can do so from the Windows Azure management portal. Go to the VMs tab. Choose 'DISKS' from the top menu and remove it. If I remember well, it will also ask you whether you'd also like to delete the blob (VHD) from the storage account.

Resources