how to list resources over a vm on microsoft azure? - azure

I have a old vm on microsoft azure, that I need to delete. There are a bunch of resources over that vm (vnet, public ip, disk, ...)
As I don't want to have unused resources, is it possibile to list all resources linked to another?
thank so much!
N.

there is nothing built-in in Azure to achieve this, kinda. One way of doing this (if you are not using shared virtual networks, backups, etc) is to put all the resources that logically relate to the vm in the same resource group and just delete the resource group.
an alternative would be to create a script to delete all the related resources along with the vm

Related

What is similar to Azure "Resource Group" in Oracle Cloud infrastructure?

I'm fairly new to OCI.
What is a similar or close concept in Oracle Cloud Infrastructure similar to Microsoft Azure "Resource Groups"?
In Azure when a resource group is deleted all resources in that group will also be deleted along with it. But "Compartments" in Oracle cloud infrastructure is not the exact same concept, because in order to delete a compartment, each resource should be deleted first and then the compartment should be deleted. Is it possible to delete a compartment along with its resources without deleting resources one by one?
I see two options here:
You may use instance pools. Deleting an instance pool will delete all
of its resources, but that only includes instances, boot volumes and
block volumes. Networking and other resources wouldn't be impacted. Instance Pool only works for compute instances having the same configuration, so this is not a generic solution for your question.
Resource Manager can be used to create a stack with all the resources
you need. When you destroy a stack by launching a destroy job, it will delete all the resources that are part of the stack. But resource manager requires you to
create Terraform config files, which can be applied through the OCI
Console. This also means that you cannot create any components of the stack
manually using the GUI, you have to keep using the Resource Manager even if you would like to update any resources of the stack.
Compartments in Oracle Cloud Infrastructure is similar to Azure Resource groups.
As per the doc, It is not possible to delete all the resources in compartment at a time similar to Azure.

Still paying for a deleted VM

I am just exploring Azure and I made a Virtual Machine using the portal and I deleted that after two hours or something.
In my cost management I can see that I am still paying for that resource group that contained components of the Virtual Machine, it is been a week since I deleted it.
I am still paying for that resource group even though I can't see it in my resource groups, neither on the portal nor on Powershell.
Is this a common issue?
As per this doc, I suggest you check if all disks attached to the vm are not deleted.
For managed disk, please follow this to find and delete them.
For Unmanaged disks(the vhd files stored in azure blob storage), please follow this to find and delete them.
Delete any orphaned Network Interface Cards (NIC) and Public IPs that were associated with the VM. They are billed even when the VM is deleted.
Update:
run powershell in azure portal:

Different instances of same infrastructure in terraform azure?

I have written part of an infrastructure in terraform connected to azure with a resourcegroup which has a virtual network and consists of two different SQL databases. The idea is to use this for different customers, which means I want to build up this infrastructure several times to create one resourcegroup with all the mentioned stuff for each customer. However I can't seem to understand how to get different instances of it? Right now the resourcegroup in azure gets overwritten whenever I try to create another one with a different name.
I would also like to ask about virtual networks. In the structure described above, will all customers be isolated from eachother with own resourcegroup containing a virtual network?
I read somewhere that virtual networks are good because they isolate so I am just wondering if that is true.
You just need to deploy terraform template to different resource group. And for the vnets - yes. unless you peer\connect vnets with vpn they are isolated from each other.

Azure - VM Generalize

I write this question because I found only partial informations about my scenario.
In Azure to clone a VM, I need to deallocate and generalize, after I can create a lot of copy as many I would. The details that I didn't find are:
the VM generalized "cost" me in term of CORE ? After azure vm generalize , If I run azure vm list-usage the number of cores used decreased or not ?
if I generalize a VM with all users / groups / services configured (Apache, DB, etc.) in the same disk of VM, after generalize -> clone, I will find again this configurations in new cloned VMs ?
what are the parameters that I can change after generalization, ex. Availability Set, Network Security Group, Nic associated, etc. ?
Thanks
the VM generalized "cost" me in term of CORE ? If I run azure vm list-usage the number of cores used decreased or not ?
Yes, it costs you in the term of CORE. However, you don't need pay for the VM. You only need pay for the OS and date VHDs storage account. When you use vm list-usage, you will find the core CurrentValue does not change. When you delete the VM, the cores will be released.
I will find again this configurations in new cloned VMs
Yes, you could. Sysprep removes all your personal account information, among other things, and prepares the machine to be used as an image. More information please refer to this link. For a Linux VM, please refer to this link.
what are the parameters that I can change after generalization, ex.
Availability Set, Network Security Group, Nic associated, etc. ?
You could use the generalized VHD image to create any VMs. All of them you could associate to the new VM. More information about how to create a VM from a generalized VHD image please refer to this link.
VM's are billed according to their capacity, not on the basis of whether they are generalized or not, a vm and a vm created from generalized vm would cost the same (granted they are the same "size").
this question has nothing to do with azure, it's just a syprep. Azure adds nothing to this process.
Anything you would expect when creating a new VM.
you need to understand the basic concepts behind virtualization to understand what is going on there.
https://en.wikipedia.org/wiki/Virtualization

Azure VMs are not able to inter-communicate each other

I have created few virtual machines with same ResourceGroup and NetworkSecurityGroup. I am not using custom DNS but default one.
Now, I want these machines to talk each other, can use shared folders of each others and so on.
For example: VM named Machine-2 can access shared folder of another VM Machine-1 like: \\\Machine-1\SharedFolder
I have gone through some similar threads like below:
Azure VMs Virtual Network inter-communication
https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-name-resolution-for-vms-and-role-instances/
Right now, these VMs are even not ping-able from others.
You should look at Azure Files. It exploits your existing storage account and it is very easy to use.

Resources