Skip to main content

savings_plans

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

Overview

Namesavings_plans
TypeResource
Idazure.billing.savings_plans

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
appliedScopePropertiesobjectProperties specific to applied scope type. Not required if not applicable.
appliedScopeTypestringType of the Applied Scope. Known values are: "Single", "Shared", and "ManagementGroup". (Single, Shared, ManagementGroup)
benefitStartTimestring (date-time)This is the DateTime when the savings plan benefit starts.
billingAccountIdstringFully-qualified identifier of the billing account where the savings plan is applied.
billingPlanstringRepresents the billing plan in ISO 8601 format. Required only for monthly purchases. "P1M" (P1M)
billingProfileIdstringFully-qualified identifier of the billing profile where the savings plan is applied. Present only for Field-led or Customer-led customers.
billingScopeIdstringSubscription that will be charged for purchasing SavingsPlan.
commitmentobjectCommitment towards the benefit.
customerIdstringFully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers.
displayNamestringDisplay name.
displayProvisioningStatestringThe provisioning state of the savings plan for display, e.g. Succeeded.
effectiveDateTimestring (date-time)DateTime of the savings plan starting when this version is effective from.
expiryDateTimestring (date-time)This is the date-time when the savings plan will expire.
extendedStatusInfoobjectExtended status information.
productCodestringRepresents UPN.
provisioningStatestringThe provisioning state of the resource during a long-running operation. Known values are: "Succeeded", "Canceled", "Failed", "New", "Pending", "Provisioning", "PendingBilling", "ConfirmedBilling", "Creating", "Created", and "Expired". (Succeeded, Canceled, Failed, New, Pending, Provisioning, PendingBilling, ConfirmedBilling, Creating, Created, Expired)
purchaseDateTimestring (date-time)Date time when the savings plan was purchased.
renewbooleanSetting this to true will automatically purchase a new benefit on the expiration date time.
renewDestinationstringSavingsPlan Id of the SavingsPlan which is purchased because of renew.
renewPropertiesobjectProperties specific to renew.
renewSourcestringSavingsPlan Id of the SavingsPlan from which this SavingsPlan is renewed.
skuobjectSavings plan SKU. Required.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
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 < > % & \ ? /.
termstringRepresents the Savings plan term in ISO 8601 format. Known values are: "P1Y", "P3Y", and "P5Y". (P1Y, P3Y, P5Y)
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
userFriendlyAppliedScopeTypestringThe applied scope type of the savings plan for display, e.g. Shared.
utilizationobjectSavings plan utilization.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_billing_accountselectbilling_account_name, savings_plan_order_id, savings_plan_idexpandGet savings plan by billing account.
list_by_savings_plan_orderselectbilling_account_name, savings_plan_order_idList savings plans in an order by billing account.
list_by_billing_accountselectbilling_account_namefilter, orderBy, skiptoken, take, selectedState, refreshSummaryList savings plans by billing account.
update_by_billing_accountupdatebilling_account_name, savings_plan_order_id, savings_plan_idUpdate savings plan by billing account.
validate_update_by_billing_accountexecbilling_account_name, savings_plan_order_id, savings_plan_idValidate savings plan patch by billing account.

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
billing_account_namestringThe ID that uniquely identifies a billing account. Required.
savings_plan_idstringID of the savings plan. Required.
savings_plan_order_idstringOrder ID of the savings plan. Required.
expandstringMay be used to expand the planInformation. Default value is None.
filterstringThe filter query option allows clients to filter a collection of resources that are addressed by a request URL. Default value is None.
orderBystringThe orderby query option allows clients to request resources in a particular order. Default value is None.
refreshSummarystringTo indicate whether to refresh the roll up counts of the savings plans group by provisioning states. Default value is None.
selectedStatestringThe selected provisioning state. Default value is None.
skiptokennumberThe number of savings plans to skip from the list before returning results. Default value is None.
takenumberThe number of savings plans to return. Default value is None.

SELECT examples

Get savings plan by billing account.

SELECT
id,
name,
appliedScopeProperties,
appliedScopeType,
benefitStartTime,
billingAccountId,
billingPlan,
billingProfileId,
billingScopeId,
commitment,
customerId,
displayName,
displayProvisioningState,
effectiveDateTime,
expiryDateTime,
extendedStatusInfo,
productCode,
provisioningState,
purchaseDateTime,
renew,
renewDestination,
renewProperties,
renewSource,
sku,
systemData,
tags,
term,
type,
userFriendlyAppliedScopeType,
utilization
FROM azure.billing.savings_plans
WHERE billing_account_name = '{{ billing_account_name }}' -- required
AND savings_plan_order_id = '{{ savings_plan_order_id }}' -- required
AND savings_plan_id = '{{ savings_plan_id }}' -- required
AND expand = '{{ expand }}'
;

UPDATE examples

Update savings plan by billing account.

UPDATE azure.billing.savings_plans
SET
properties = '{{ properties }}',
sku = '{{ sku }}',
tags = '{{ tags }}'
WHERE
billing_account_name = '{{ billing_account_name }}' --required
AND savings_plan_order_id = '{{ savings_plan_order_id }}' --required
AND savings_plan_id = '{{ savings_plan_id }}' --required
RETURNING
id,
name,
properties,
sku,
systemData,
tags,
type;

Lifecycle Methods

Validate savings plan patch by billing account.

EXEC azure.billing.savings_plans.validate_update_by_billing_account 
@billing_account_name='{{ billing_account_name }}' --required,
@savings_plan_order_id='{{ savings_plan_order_id }}' --required,
@savings_plan_id='{{ savings_plan_id }}' --required
@@json=
'{
"benefits": "{{ benefits }}"
}'
;