/Azure

Microsoft Azure

Primary LanguagePowerShellMIT LicenseMIT

azureautomation2 Azure Repo

Microsoft Azure POSH scripts and modules

To install this module, drop the entire 'Az-Module' folder into one of your module directories.

The default PowerShell module paths are listed in the $env:PSModulePath environment variable.

To make it look better, split the paths in this manner: $env:PSModulePath -split ';'

The default per-user module path is: "$env:HOMEDRIVE$env:HOMEPATH\Documents\WindowsPowerShell\Modules".

The default computer-level module path is: "$env:windir\System32\WindowsPowerShell\v1.0\Modules".

To use the module, type following command: Import-Module Az-Module -Force -Verbose.

To see the commands imported, type Get-Command -Module Az-Module.

For help on each individual cmdlet or function, run Get-Help CmdletName -Full [-Online][-Examples].

To start using the module functions:

  • Install Azure Resource Manager Module module from Microsoft PSGallery by Install-Module AzureRM.
  • Connect to your Azure account by Login-AzureRmAccount cmdlet.
  • Optionally, select your target subscription by Select-AzureRmSubscription cmdlet.

Az-Module Cmdlets:

No Cmdlet Description
1 [Get-AzVmPowerState] (http://www.ps1code.com/single-post/2016/06/19/Azure-Automation-How-to-stopstart-Azure-VM-on-schedule) This filter gets AzureRm VM PowerState
2 [Get-AzVmTag] (http://www.ps1code.com/single-post/2016/06/19/Azure-Automation-How-to-stopstart-Azure-VM-on-schedule) This filter gets AzureRm VM Tag value
3 [Add-AzVmTag] (http://www.ps1code.com/single-post/2016/06/29/Azure-VM-Tag-automation) This cmdlet adds/sets Resource Tag/Tags for Azure VMs
4 [Get-AzOrphanedVhd] (http://www.ps1code.com/single-post/2016/07/18/How-to-find-orphaned-VHD-files-in-the-Azure-IaaS-cloud) This cmdlet finds orphaned* Azure VM disks. Orphaned virtual disks - these are *.vhd files that reside on Storage Accounts, but are not related to any VM
5 [Get-AzVmDisk] (http://www.ps1code.com/single-post/2016/08/31/Azure-Automation-How-to-add-a-data-disk-to-an-Azure-VM-with-PowerShell) This function gets Azure VM Virtual Disks
6 [New-AzVmDisk] (http://www.ps1code.com/single-post/2016/08/31/Azure-Automation-How-to-add-a-data-disk-to-an-Azure-VM-with-PowerShell) This function creates and attaches a new data disk to an Azure Virtual Machine
7 [New-AzCredProfile] (http://www.ps1code.com/single-post/2017/01/04/How-to-login-to-the-Azure-automatically) This function sets your PowerShell session to automatically login to the Azure

This script deploys multiple Azure VM from JSON templates.

In MSDN subscription it adds public IP and uses DHCP for internal IP address.

For all another subscriptions no Public IP created and static internal IP assigned.

This script creates file that contains encrypted password for Azure VM local admin account.

"adminPassword" parameter from JSON template.

JSON template example for standalone Azure Windows VMs in MSDN subscription.

JSON template example for Availability Set members Azure Windows VMs in MSDN subscription.