Billing Tool Command Reference
The Billing tool commands are handy commands that interacts will the Billing API service and Billing database to perform operations and to get different reports.
The Billing tool is usually found inside the update bundle that is shared during every release. To run the billing commands, navigate inside the 'BillingTool' folder, open an elevated PS window and execute the desired commands. The commands can be run in two ways.
  • By passing the Billing API credentials as command parameters.
.\Billing.exe CollectAllLogs /days:5 /ApiEndpoint:https://localhost:44306 /Username:admin /Password:[email protected]
  • Saving the Billing API credentials once in the tool config file (Billing.exe.config) and running the command alone.
Billing API Credentials in Billing.exe.config file
.\Billing.exe CollectAllLogs /days:5

Updating Billing Database

The command enables updating the Billing database. Before running the command, it would be good to ensure that the Billing database connection string is specified in 'C:\inetpub\MgmtSvc-CloudAssertBilling\Web.config' file.
Billing database connection string in 'C:\inetpub\MgmtSvc-CloudAssertBilling\Web.config'' file.
.\Billing.exe UpdateDatabase

Monitor Billing Agent Health

The command gives the health of Billing Agent service.
.\Billing.exe GetUsageAggregationStatus
Billing Agent Health

Collecting Logs

The command collects all necessary logs and compresses it to a zip file. Passing the optional parameter '/days:' will collect the recent logs for the duration specified number of days. If the '/days' parameter is not specified, the tool will collect all the available billing logs.
.\Billing.exe CollectAllLogs /days:<int>
.\Billing.exe CollectAllLogs
Log Collection for Troubleshooting Billing Resource Provider

Protect Config Files

The command will encrypt the config files.
.\Billing.exe SecureConfig "<file path>"
.\Billing.exe SecureConfig "C:\inetpub\MgmtSvc-CloudAssertBilling\Web.config"

Unprotect Config Files

the command will decrypt the config files.
.\Billing.exe UnSecureConfig "<file path>"
.\Billing.exe UnSecureConfig "C:\inetpub\MgmtSvc-CloudAssertBilling\Web.config"

Create Azure Stack Hub Stamp Connection

The command helps in creating a connection to Azure Stack Hub stamp so that the Cloud Assert Billing solution can query usage and compute cost for the same. The connection can be created either using azure app secret (AAD Integrated System) or certificate thumbprint (ADFS Integrated System). Refer 'Cost Management Across Multiple Azure Stack Hub Stamps' to get the necessary inputs to create the connection.

Connection with App Secret

.\Billing.exe CreateAzureStackConnection <connectionName> <adminSubscriptionId> <tenantId> <applicaionId> <adminArmEndpoint> <tokenRequestResourceUrl> <authorityEndpointUrl> [/applicationSecret:<String>]
.\Billing.exe CreateAzureStackConnection "Azs-Hub-01" "eeea58bf-9184-4b9a-8299-66c89a91f78c" "1e3cf5be-16b5-4c3c-9ca7-98a0074854a0" "c5543be6-78a3-4498-9b1d-2e225d6b2856" "https://adminmanagement.local.azurestack.external" "" "" /applicationSecret:"k+amxQUyMqXWN2Ug=="

Connection with Certificate Thumbprint

.\Billing.exe CreateAzureStackConnection <connectionName> <adminSubscriptionId> <tenantId> <applicaionId> <adminArmEndpoint> <tokenRequestResourceUrl> <authorityEndpointUrl> [/certificateThumbprint:<String>] [/isAdfs]
.\Billing.exe CreateAzureStackConnection "Azs-Hub-02" "a7960fbc-a502-452a-8865-dcec48d20ed1" "cc4aa06d-3177-457a-a4b4-a4f8d4a5aa2d" "30fe4a8c-7eb6-4511-889d-8703fb3189e2" "https://adminmanagement.local.azurestack.external" "https://adminmanagement.adfs.azurestack.local/30fe4a8c-7eb6-4511-889d-8703fb3189e2" "" /certificateThumbprint:"39ae733bf3ba4fb7b4199d91b4103ea2316fd470" True

Update VConnect API Credentials

The command save the VConnect API credentials in the Billing 'AppSettings' table. These credentials will be used to query VConnect usage, create tenant Azure Stack Hub connections, etc.
.\Billing.exe AddOrUpdateVConnectApiSettings <vconnectApiUrl> <vconnectApiUser> <vconnectApiPassword>
.\Billing.exe AddOrUpdateVConnectApiSettings "https://vconnect.cloudassert.local.azurestack.external:44305" "cloudassertadminuser" "[email protected]"