Configuring the Windows Azure Pack Usage Service

 

Applies To: Windows Azure Pack

A billing system deployment requires the Windows Azure Pack Usage Service to know where the billing adapter is located and also allow the billing adapter to subscribe to the Billing Approval REST API event notification system.

Billing Adapter Configuration

If the billing adapter is implemented as a web application the application Web.config file will need the following properties set:

<!-- Billing Adapter settings -->
    <add key="BillingAdapterUsername" value="<Notification Username>" />
    <add key="BillingAdapterPassword" value="<Notification Password>" />

    <!-- REST API settings -->
    <add key="UsageServiceUsername" value="<REST API Username>" />
    <add key="UsageServicePassword" value="<REST API Password>" />
    <add key="UsageServiceEndpoint" value="https://<Usage Service host>:30022/" />
    <add key="UsageServiceBatchSize" value="100" />
    <add key="DisableSslVerification" value="true" />
    <add key="SyncIntervalMilliseconds" value="60000" />

Windows Azure Pack Configuration

Windows Azure Pack will need to know about billing adapter location. To do that, perform the following steps:

To Configure Windows Azure Pack for Windows Server for Use With a Billing Adapter

  1. Start the Windows Azure Pack Configuration PowerShell environment.

  2. Run the following PowerShell commands replacing <REST API Username> with the UsageServiceUsername value from the billing adapter Web.config value (see above) and <REST API Password> from UsageServicePassword from the same Web.config file.

    Set-MgmtSvcSetting -Namespace UsageService -Name Username -Value '<REST API Username>'
    
    Set-MgmtSvcSetting -Namespace UsageService -Name Password -Value '<REST API Password>' –Encode
    
    Set-MgmtSvcDatabaseSetting –ConnectionString '<Connection String>' –Namespace UsageService –Name Password –Value '<REST API Password>' –Passphrase '<Passphrase>' 
    –Force
    

Configuring Billing Approval REST API Notification Subscription

The Billing Approval REST API endpoint allows the billing adapter to receive the event notifications for subscription creation, update and deletion. To function, the billing adapter must subscribe to the Windows Azure Pack event notification system:

To Configure Notification Subscription for a Billing Adapter

  1. Ensure that the Billing Adapter is running.

  2. Start the Windows Azure Pack Configuration PowerShell environment.

  3. Register the billing adapter with the following PowerShell command:

    Set-MgmtSvcNotificationSubscriber -Endpoint <Endpoint> -Name <Name> 
    -AuthenticationMode Basic -AuthenticationPassword <Notification Password> 
    -AuthenticationUsername <Notification Username> -Enabled $True -Force -SubscriberType BillingService
    

    Replace the <XYZ> values with those for your environment. <Endpoint> should be the URL at which the billing adapter is available followed by /BillingAdapter. For example, https://localhost:1234/BillingAdapter/. The Name setting is for your reference and can be set arbitrarily. The AuthenticationUsername and AuthenticationPassword settings should match the billing adapter’s BillingAdapterUsername and BillingAdapterPassword in the billing adapter Web.config file (see above).

Set-MgmtSvcNotificationSubscriber

Set-MgmtSvcNotificationSubscriber -Name Billing –SubscriberType BillingService -Enabled $false -Endpoint https://localhost/ -AuthenticationMode Basic 

The Set-MgmtSvcNotificationSubscriber cmdlet is used to register the billing adapter. Set-MgmtSvcNotificationSubscriber assumes that the Windows Azure Pack management Database Server is local, and uses integrated security to access the database. To connect to a remote server use -ConnectionString OR the granular database parameters (-Server, - UserName, -Password, -Database).

The Set-MgmtSvcNotificationSubscriber also assumes that the Usage Service was installed locally on the machine the command is run at. If this is a remote call specify the encryption parameters (-EncryptionKey, -EncryptionAlgorithm).

For more information, see https://technet.microsoft.com/en-us/library/dn520969(v=sc.20).aspx.

Two of the parameters have particular significance:

-SubscriberType

There are three subscriber types that can be set by the –SubscriberType parameter.

  • BillingService

  • MandatoryService

  • OptionalService

The billing adapter can be set up to handle events in a blocking or a non-blocking manner. The subscriber types BillingService and MandatoryService are both blocking. OptionalService is non-blocking. If the billing adapter is set up to be blocking, a plan creation event in the service management API should trigger a corresponding plan to be created in the billing system. If this operation is not successful the plan creation at the service management API will fail. This enables consistency between the platform and the billing system.

Important

There can only be one BillingService subscriber type in the system. There can be multiple MandatoryService and OptionalService subscribers.

-NotificationSubscriber

If the -NotificationSubscriber parameter is not specified, it is derived from the related parameters (-Name, -Enabled, -SubscriberType, -Endpoint, -AuthenticationMode, -AuthenticationUsername, -AuthenticationPassword).

See Also

Windows Azure Pack Usage Service