Skip to main content

subscriptions

Creates, updates, deletes, gets or lists a subscriptions resource.

Overview

Namesubscriptions
TypeResource
Idazure.billing.subscriptions

Fields

The following fields are returned by SELECT queries:

A billing subscription.

NameDatatypeDescription
propertiesobjectThe properties of a(n) BillingSubscription
tagsobjectDictionary of metadata associated with the resource. It may not be populated for all resource types. Maximum key/value length supported of 256 characters. Keys/value should not empty value nor null. Keys can not contain < > % & \ ? /

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_billing_profileselectbillingAccountName, billingProfileName, billingSubscriptionNameexpandGets a subscription by its billing profile and ID. The operation is supported for billing accounts with agreement type Enterprise Agreement.
list_by_customerselectbillingAccountName, billingProfileName, customerNameincludeDeleted, expand, filter, orderBy, top, skip, count, searchLists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
list_by_billing_profileselectbillingAccountName, billingProfileNameincludeDeleted, expand, filter, orderBy, top, skip, count, searchLists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement.
getselectbillingAccountName, billingSubscriptionNameexpandGets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement, Microsoft Partner Agreement, and Enterprise Agreement.
list_by_customer_at_billing_accountselectbillingAccountName, customerNameincludeDeleted, expand, filter, orderBy, top, skip, count, searchLists the subscriptions for a customer at billing account level. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
list_by_enrollment_accountselectbillingAccountName, enrollmentAccountNamefilter, orderBy, top, skip, count, searchLists the subscriptions for an enrollment account. The operation is supported for billing accounts with agreement type Enterprise Agreement.
list_by_billing_accountselectbillingAccountNameincludeDeleted, includeTenantSubscriptions, includeFailed, expand, filter, orderBy, top, skip, count, searchLists the subscriptions for a billing account.
updateupdatebillingAccountName, billingSubscriptionNameUpdates the properties of a billing subscription.
deletedeletebillingAccountName, billingSubscriptionNameCancels a billing subscription. This operation is supported only for billing accounts of type Microsoft Partner Agreement or Microsoft Customer Agreement.
cancelexecbillingAccountName, billingSubscriptionName, cancellationReasonCancels a usage-based subscription. This operation is supported only for billing accounts of type Microsoft Partner Agreement.
mergeexecbillingAccountName, billingSubscriptionNameMerges the billing subscription provided in the request with a target billing subscription.
moveexecbillingAccountName, billingSubscriptionNameMoves charges for a subscription to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement.
splitexecbillingAccountName, billingSubscriptionNameSplits a subscription into a new subscription with quantity less than current subscription quantity and not equal to 0.
validate_move_eligibilityexecbillingAccountName, billingSubscriptionNameValidates if charges for a subscription can be moved to a new invoice section. This operation is supported for billing accounts with agreement type Microsoft Customer Agreement.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
billingAccountNamestringThe ID that uniquely identifies a billing account.
billingProfileNamestringThe ID that uniquely identifies a billing profile.
billingSubscriptionNamestringThe ID that uniquely identifies a subscription.
customerNamestringThe ID that uniquely identifies a customer.
enrollmentAccountNamestringThe name of the enrollment account.
countbooleanThe count query option allows clients to request a count of the matching resources included with the resources in the response.
expandstringCan be used to expand Reseller, ConsumptionCostCenter, LastMonthCharges and MonthToDateCharges
filterstringThe filter query option allows clients to filter a collection of resources that are addressed by a request URL.
includeDeletedbooleanCan be used to get deleted billing subscriptions.
includeFailedbooleanCan be used to get failed billing subscriptions.
includeTenantSubscriptionsbooleanCan be used to get tenant-owned billing subscriptions. This field is only applies to Microsoft Online Services Program billing accounts.
orderBystringThe orderby query option allows clients to request resources in a particular order.
skipinteger (int64)The skip query option requests the number of items in the queried collection that are to be skipped and not included in the result.
topinteger (int64)The top query option requests the number of items in the queried collection to be included in the result. The maximum supported value for top is 50.

SELECT examples

Gets a subscription by its billing profile and ID. The operation is supported for billing accounts with agreement type Enterprise Agreement.

SELECT
properties,
tags
FROM azure.billing.subscriptions
WHERE billingAccountName = '{{ billingAccountName }}' -- required
AND billingProfileName = '{{ billingProfileName }}' -- required
AND billingSubscriptionName = '{{ billingSubscriptionName }}' -- required
AND expand = '{{ expand }}'
;

UPDATE examples

Updates the properties of a billing subscription.

UPDATE azure.billing.subscriptions
SET
data__tags = '{{ tags }}',
data__properties = '{{ properties }}'
WHERE
billingAccountName = '{{ billingAccountName }}' --required
AND billingSubscriptionName = '{{ billingSubscriptionName }}' --required
RETURNING
properties,
tags;

DELETE examples

Cancels a billing subscription. This operation is supported only for billing accounts of type Microsoft Partner Agreement or Microsoft Customer Agreement.

DELETE FROM azure.billing.subscriptions
WHERE billingAccountName = '{{ billingAccountName }}' --required
AND billingSubscriptionName = '{{ billingSubscriptionName }}' --required
;

Lifecycle Methods

Cancels a usage-based subscription. This operation is supported only for billing accounts of type Microsoft Partner Agreement.

EXEC azure.billing.subscriptions.cancel 
@billingAccountName='{{ billingAccountName }}' --required,
@billingSubscriptionName='{{ billingSubscriptionName }}' --required
@@json=
'{
"cancellationReason": "{{ cancellationReason }}",
"customerId": "{{ customerId }}"
}'
;