Author: Matthew Dowst

Azure

Encrypt All Azure Automation Variables

$ResourceGroupName = '' $AutomationAccountName = '' # Get all variables $variables = Get-AzureRMAutomationVariable -ResourceGroupName $ResourceGroupName -AutomationAccountName $AutomationAccountName # parse through each unencrypted variable Foreach($var in $variables | Where-Object{$_.Encrypted -ne $True}){ # remove the unencrypted variable Remove-AzureRMAutomationVariable -ResourceGroupName $var.ResourceGroupName -AutomationAccountName $var.AutomationAccountName -Name $var.Name # recreate the variable, with the same values and encrypt it New-AzureRMAutomationVariable -ResourceGroupName $var.ResourceGroupName -AutomationAccountName $var.AutomationAccountName -Name $var.Name...
Azure

Get All Azure Virtual Machine IP Addresses

[System.Collections.Generic.List[PSObject]] $IPAddresses = @() $VMs = Get-AzureRMVM foreach($VM in $VMs){ foreach($interface in $VM.NetworkProfile.NetworkInterfaces){ $resource = Get-AzureRMResource -id $interface.Id $nic = Get-AzureRmNetworkInterface -Name $resource.Name -ResourceGroupName $resource.ResourceGroupName Get-AzureRmNetworkInterfaceIpConfig -NetworkInterface $nic | Select-Object @{l='VM';e={$VM.Name}}, PrivateIpAddress, PrivateIpAllocationMethod | ForEach-Object{ $IPAddresses.Add($_) } } } $IPAddresses