![]() ![]() | project id, resourceGroup, location, subscriptionId ![]() | where type has "work/networkinterfaces" If said VM is deleted its resourceId is also deleted. When a disk is properly attached to a VM the managedBy field will have the resourceId filled out by the corresponding VM. This query looks in the Compute/Disks resource type for disks that either have empty managedBy field, or their disk state is Unattached. | project id, diskState, resourceGroup, location, subscriptionId | extend diskState = tostring(properties.diskState) However, you get changed money for the storage that is still being consumed. So it is often the most common resources left orphaned. This is because you might want to rebuild the VM with the same disks. When a VM is deleted the NIC and disks are not deleted. If you don’t have reader level access these resources will simply not show up for you. You’ll also need reader level access to any resources you want to query in your subscriptions. ![]() However, you can also use PowerShell or other languages to query the API. Most of the time you’ll use it in the portal. It uses Kusto Query Language for its queries. If you’re not familiar with Azure Resource Graph, it is a completely free service in Azure. We’ll do this using Azure Resource Graph. I will also be adding more queries to the repo as I come up with them. These queries are all in the repo, but I’m doing a separate post on this because I feel its a pretty common problem to have orphaned resources. As a follow up to my Azure Resource Graph examples repo, I have a few queries to find orphaned Azure resources. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |