Azure Enterprise Agreement Billing API And Billing Updates

In this post I’m going to have a look at the Azure Enterprise Agreement Billing API and billing updates. The updates enable emailing invoices and some PowerShell cmdlets to retrieve invoices.

Emailing Invoices

You can opt in to receive your monthly invoice via email, which beats logging into the portal to download them every time. You’ll find the options to configure recipients on the Invoices menu in the Subscriptions blade.

InvoicesBlade

This feature is only available to consumer Azure subscriptions.

PowerShell Invoice Cmdlet

The Get-​Azure​Rm​Billing​Invoice cmdlet that provides the ability to download invoices is currently in preview. Before you can successfully use the cmdlet you have to enable access to your invoices in the Subscription blade of the Azure Portal.

InvoiceCmdLets

By default users with Subscription administration access will be able to retrieve invoices. You can grant other users access by assigning the Billing Reader role to users from the Access Control menu on the Subscription blade.

BillingRBAC

Calling the Get-​Azure​Rm​Billing​Invoice cmdlet doesn’t return the actual invoice but rather an Invoice object that contains amongst others a DownloadURL property that you can use to download the invoice. Note the URL is valid for 1 hour.

Login-AzureRmAccount
 $inv = Get-AzureRmBillingInvoice -Latest
 Invoke-WebRequest -Uri $inv.DownloadUrl -OutFile C:\Temp\Invoice.pdf

This feature is only available to consumer Azure subscriptions.

Invoice Retrieval For Enterprise Agreement Customers

If your are an EA customer the above method won’t work for you but you can download your usage and charges using the Billing Rest API for EA customers. In some respects this is easier for EA customers since the dataset returned contains usage and charges, you don’t have to calculate it separately. Before using the API you have to get your API key from the EA portal.

EA

You can find out more about using the API in this channel 9 video which also contains this link in the show notes that describes the API.

PowerBI Integration With The EA Portal

You can also export your billing data to PowerBI from the EA portal using the Power BI Reporting tab on the Reports menu. This functionality is provided by the Power BI Enterprise Pack, although it is a manual process to export data the first time, you can schedule the dataset to refresh automatically, more here and you can subscribe to report emails, it is in preview so the functionality is still evolving, more here.

Retrieve Usage Using PowerShell Cmdlets

The Get-UsageAggregates cmdlet is not a new feature but I didn’t get a chance to cover it yet. You can use it to retrieve resource usage, take note that the cmdlet makes use of a continuation token since the dataset can be quite large if you download detailed usage. Your billing charges can be calculated by retrieving the rates separately using the RateCard API and matching it to your usage, I covered the RateCard API in a previous post. The Get-UsageAggregates cmdlet is available to consumer Azure subscriptions and Enterprise Agreement subscriptions but the RateCard API is for consumer Azure subscriptions only.

Francois Delport

Visual Studio 2017 Installer New Features

Visual Studio 2017 Installer New Features

At a high level the installation has been broken down into smaller chunks called workloads. You select which workloads you want to use and only the components required for the selected workloads will be installed. If you want to you can still fall back to the old method of installing individual components. The Visual Studio setup is available as an on-line installer only. You can’t download the ISO from MSDN or the Microsoft website any more. You can create your own off-line installer but more about that later in the post.

The Package Cache

For the installer to work and also perform maintenance tasks like updating and repairing your Visual Studio (VS) installation the VS installer will keep downloaded packages in a package cache. By default the package cache is in:

"%ProgramData%\Microsoft\VisualStudio\Packages"

At the time of writing the ability to disable or move the package cache was in preview, instructions here. Using the VS installer you can disable the package cache but that would have some nasty side affects. Every package the VS installer needs for updating or repairing your installation will be downloaded from the internet and deleted again after the installation is done. You can also specify the location to use for the package cache in the registry. If you create the registry key before you start the installation the VS installer will place the packages in the specified location. For existing installations you have to manually move the packages to the new location.

Creating An Offline Installer

You can create an offline installer using the –layout switch of the VS setup exe:

vs_enterprise.exe --layout c:\vs2017offline [--lang en-US]

The full VS 2017 download is quite large but you can save some space by specifying which language you want to use. By default it will download all of them. Keep in mind the VS installer will download files to your AppData temp folder before moving them to the layout folder. I ran into a problem with one installation where the installer was caching the whole installation in the AppData temp folder on my C: drive even though I was creating the offline installer on a different drive. I was unable to determine the cause but keep that in mind if you don’t have enough free space on your C: drive. To install VS using the offline installer you have to install the certificates used to verify the downloaded packages, instructions here.

Updating The Offline Installer

By default VS will look for updates online even if it was installed from an offline installer but you can force VS to look for updates in the offline installer folder by changing its ChannelURI. You have to edit the response.json file in your offline installer directory and change the ChannelURI value to point to the channelManifest.json file in your offline installer folder, full instructions here.

To update the offline installation folder you can run the VS installer with the
–layout parameter. Pointing it to the existing offline folder, the VS installer will download any new packages to the folder and update the channelManifest.json file. VS installations whose ChannelURI is pointing to the offline installer will pick up the updates from the folder instead of downloading them. At the time of writing the VS installer didn’t purge old packages from the layout folder, it only added new ones so the folder can grow significantly. I guess it makes sense since older VS installations would still need the older packages to repair installations or add features.

Setup Tools

There are also some new tools to detect Visual Studio installations instead of rummaging through the registry.

  • The VSSetup Powershell Module can be installed from the PowerShell gallery using:
Install-Module VSSetup
  • VSWhere exe can be downloaded from the GitHub page here.

Francois Delport