Kemuel Toledo
Kemuel Toledo

Reputation: 33

Remove existing VHD on new portal azure using c#

I have a windows application that creates a VM on the new portal of azure(not the classic VM). Somehow when I delete my currently created VM and try to recreate that VM with the same name I always get an error.

http://(someStorage).blob.core.windows.net/vhds/(somename)_osdisk.vhd already exists. Please provide a different blob URI as target for disk '(somename)_osdisk'.

The way that I could fix this is thru the new portal and delete the VHD with the same name of the newly created VM's VHD.

I wonder if there is a way that I could remove that VHD using C# code. Its too tiresome if I delete this always on the new portal.

Upvotes: 2

Views: 522

Answers (1)

Jack Zeng
Jack Zeng

Reputation: 2267

a VHD in Azure is just a blob in Azure storage. Hence deleting a VHD is just deleting a blob in the Storage. DOT NET has a nice API for Azure Storage. See the Document here.

Upvotes: 0

Related Questions