Audit Azure ASR VMs enablement & compliance

SYNOPSIS:

Display VM’s without Azure Site Recovery extension

DESCRIPTION :

This script creates a list of all VM’s within an subscription they audits to see which have the “*siterecovery*” extension in their definitions. That list is then checked against all the azure vm’s reported in the subscrtion and the output are those remaining.

REQUIREMENTS:

AzureRm Module

SCRIPT:

param($subscriptionName, $outputPath)

Connect-AzureRmAccount

Select-AzureRmSubscription -SubscriptionName $subscriptionName

$allVms = Get-AzureRmVM -Status | ? {$_.powerstate -eq “VM Running”} | select name, resourcegroupname

$asrVms = Get-AzureRmVM | select -ExpandProperty extensions `
-Property @{name = ‘VmName’; expression = {$_.name}}, `
@{name= ‘ResourceGroup’; expression = {$_.ResourceGroupName}} `
| ? {$_.id -like “*siterecovery*”}

$allVms | ? {$_.name -notin $asrVms.vmname} | Export-Csv $outputPath

Be the first to comment

Leave a Reply

Your email address will not be published.


*