Azure Stack Hub - Detailed Usage Summary in Disconnected Mode

1 minute read

For an Azure Stack Hub in a Disconnected Scenario, I am faced with the challenge of reading the detailed usage values of the individual services and exporting them to a file.

During my research I came across two possible approaches. One of them is reading the information via the management API interface of the Azure Stack Hub and the other is reading with Powershell scripts.

I will explain the Powershell way a little bit more here.

The Powershell variation

During my further research I came across the following Powershell function: Get-AzsSubscriberUsage. This is part of the Powershell module Azs.Commerce.Admin.
(For more information see here and also here)

As an Azure Stack Hub operator, you inevitably end up with a toolset with additional Powershell scripts . Under the link you will find everything you need to evaluate the usage.

Azure Stack Tools

Remember the Pre-Reqs, please. The installation of the correct Powershell modules is required.

The scripts

The script UsageSummary.ps1 provides all usage values, without quotation. The granularity of the utilisation values can be changed between hourly and daily.

AppService Script

The script Get-AppServicesSubscriptionUsage.ps1 brings the desired usage values for App Services, including the stored prices from the script. This script loads two more Powershell scripts in the background. First the Common.ps1 and then the Get-AppServicesBillingRecords.ps1.

In addition, it should be noted that depending on the selection of the period (date) quite a lot of usage values are read out. Notice, the export file can be several MB in size.

What to do

After you have logged into the Azure Stack hub as Admin / Cloudadmin (Operator) via Powershell, you connect to the Default Provider Subscription. It is not necessary to connect to the PEP.

Then you can run one or both scripts described above. After the start of the script you will be greeted after the start time and the end time. These are date values and can be specified as: 01.03.2020. The file is exported to the directory from where you started the Powershell script.


To look at the content I use a text editor.

Next steps

The file can now be imported to another program. Further processing is also possible if the file is stored in e. g. for example, MS Excel is imported and formatted.

Anyone who is on the road as a service provider can now simply charge for the use.