I have a need to automate the download and processing of Azure billing information. My first attempt is going to be by utilizing the PowerShell AzureRM modules.
To start this process, I first needed to load the AzureRM modules on my system.This assumes that you are running Powershell on a Windows 10 system or have PowerShellGet installed. By default, PowerShellGet will be present within Powershell on Windows 10.
To check whether PowerShellGet is installed, you can issue the following command: Get-Module PowerShellGet
To install the Azure Module using PowerShellGet, you only need to running the following few commands:
1. Make sure you are logged in as a user with admin rights, or have started the PowerShell ISE or command prompt as Administrator.
2. Install-Module AzureRM -Scope CurrentUser
3. Import-Module AzureRM
At this point, you have access to all of the cmdlets present within the Azure Modules. AzureRM is a roll up module for the various Azure PowerShell modules. If you are using the ISE, you can see these present in the Commands tab by clicking on refresh and then using the drop-down to select the appropriate Module and looking at the commands.For example:
AzureRM.billing contains:
Get-AzureRMBillingInvoice
Get-AzureRMBillingPeriod