automatic & control
9 TopicsPowerShell: Find VNet of an ARM VM
Hi everyone, it took me quite some time to find a way to get the VNet an ARM VM belongs to by using PowerShell. I don't think this is the perfect solution, but I would like to share it in order someone else needs to find out. I would be interested in better ways of getting attached networks. I will start the discussion with this code snippet $vnets= Get-AzureRmVirtualNetwork $vm = Get-AzureRmVM -name $newVm.Name -ResourceGroupName $newRG $vmIPId = $vm.NetworkProfile.NetworkInterfaces.Id foreach ($vnet in $vnets){ $vnetIPId = $vnet.Subnets.IpConfigurations.Id if ($vnetIPId.Startswith($vmIPId) ){ $vnetName = $vnet.Name return } } Cheers Christian9.7KViews3likes6CommentsAzure Automation overview
Microsoft Azure Automation provides a way for users to automate the manual, long-running, error-prone, and frequently repeated tasks that are commonly performed in a cloud and enterprise environment. It saves time and increases the reliability of regular administrative tasks and even schedules them to be automatically performed at regular intervals. You can automate processes using runbooks or automate configuration management using Desired State Configuration. This article provides brief overview of Azure Automation and answers some common questions about automation and Desired State Configuration (DSC) .3.8KViews1like0Comments