credits
Creates, updates, deletes, gets or lists a credits resource.
Overview
| Name | credits |
| Type | Resource |
| Id | azure.billing_benefits.credits |
Fields
The following fields are returned by SELECT queries:
- get
- list_by_resource_group
- list_by_subscription
- list_applicable
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
billingAccountResourceId | string | Fully-qualified identifier of the billing account where the benefit is applied. Present only for Enterprise Agreement customers. |
billingProfileResourceId | string | Fully-qualified identifier of the billing profile where the benefit is applied. Present only for Field-led or Customer-led customers. |
breakdown | array | Credit line-items/milestones/no-charge services breakdown. |
credit | object | The entire investment amount for the credit contract, including currency and amount. |
customerId | string | Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. Format is /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}. |
endAt | string (date-time) | End DateTime in UTC. |
etag | string | The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |
identity | object | Managed service identity (system assigned and/or user assigned identities). |
kind | string | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. |
plan | object | Plan for the resource. |
policies | object | Credit breakdown item representing a milestone, line-item, or no-charge service. |
productCode | string | Product UPN for the credit type. |
provisioningState | string | Provisioning state. Known values are: "Creating", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed". (Creating, PendingBilling, ConfirmedBilling, Created, Succeeded, Cancelled, Expired, Failed) |
reason | object | The reason for the credit. Not required if not applicable. |
resourceId | string | Fully-qualified resource identifier of the resource. Format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}. |
sku | object | The resource model definition representing SKU. |
startAt | string (date-time) | Start DateTime. |
status | string | Status of the credit. Known values are: "Unknown", "Pending", "Active", "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted". (Unknown, Pending, Active, Succeeded, Canceled, Failed, Expired, Exhausted, NotStarted) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
systemId | string | System identifier. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
billingAccountResourceId | string | Fully-qualified identifier of the billing account where the benefit is applied. Present only for Enterprise Agreement customers. |
billingProfileResourceId | string | Fully-qualified identifier of the billing profile where the benefit is applied. Present only for Field-led or Customer-led customers. |
breakdown | array | Credit line-items/milestones/no-charge services breakdown. |
credit | object | The entire investment amount for the credit contract, including currency and amount. |
customerId | string | Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. Format is /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}. |
endAt | string (date-time) | End DateTime in UTC. |
etag | string | The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |
identity | object | Managed service identity (system assigned and/or user assigned identities). |
kind | string | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. |
plan | object | Plan for the resource. |
policies | object | Credit breakdown item representing a milestone, line-item, or no-charge service. |
productCode | string | Product UPN for the credit type. |
provisioningState | string | Provisioning state. Known values are: "Creating", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed". (Creating, PendingBilling, ConfirmedBilling, Created, Succeeded, Cancelled, Expired, Failed) |
reason | object | The reason for the credit. Not required if not applicable. |
resourceId | string | Fully-qualified resource identifier of the resource. Format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}. |
sku | object | The resource model definition representing SKU. |
startAt | string (date-time) | Start DateTime. |
status | string | Status of the credit. Known values are: "Unknown", "Pending", "Active", "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted". (Unknown, Pending, Active, Succeeded, Canceled, Failed, Expired, Exhausted, NotStarted) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
systemId | string | System identifier. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
billingAccountResourceId | string | Fully-qualified identifier of the billing account where the benefit is applied. Present only for Enterprise Agreement customers. |
billingProfileResourceId | string | Fully-qualified identifier of the billing profile where the benefit is applied. Present only for Field-led or Customer-led customers. |
breakdown | array | Credit line-items/milestones/no-charge services breakdown. |
credit | object | The entire investment amount for the credit contract, including currency and amount. |
customerId | string | Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. Format is /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}. |
endAt | string (date-time) | End DateTime in UTC. |
etag | string | The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |
identity | object | Managed service identity (system assigned and/or user assigned identities). |
kind | string | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. |
plan | object | Plan for the resource. |
policies | object | Credit breakdown item representing a milestone, line-item, or no-charge service. |
productCode | string | Product UPN for the credit type. |
provisioningState | string | Provisioning state. Known values are: "Creating", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed". (Creating, PendingBilling, ConfirmedBilling, Created, Succeeded, Cancelled, Expired, Failed) |
reason | object | The reason for the credit. Not required if not applicable. |
resourceId | string | Fully-qualified resource identifier of the resource. Format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}. |
sku | object | The resource model definition representing SKU. |
startAt | string (date-time) | Start DateTime. |
status | string | Status of the credit. Known values are: "Unknown", "Pending", "Active", "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted". (Unknown, Pending, Active, Succeeded, Canceled, Failed, Expired, Exhausted, NotStarted) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
systemId | string | System identifier. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
billingAccountResourceId | string | Fully-qualified identifier of the billing account where the benefit is applied. Present only for Enterprise Agreement customers. |
billingProfileResourceId | string | Fully-qualified identifier of the billing profile where the benefit is applied. Present only for Field-led or Customer-led customers. |
breakdown | array | Credit line-items/milestones/no-charge services breakdown. |
credit | object | The entire investment amount for the credit contract, including currency and amount. |
customerId | string | Fully-qualified identifier of the customer where the savings plan is applied. Present only for Partner-led customers. Format is /providers/Microsoft.Billing/billingAccounts/{acctId:orgId}. |
endAt | string (date-time) | End DateTime in UTC. |
etag | string | The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. |
identity | object | Managed service identity (system assigned and/or user assigned identities). |
kind | string | Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. |
plan | object | Plan for the resource. |
policies | object | Credit breakdown item representing a milestone, line-item, or no-charge service. |
productCode | string | Product UPN for the credit type. |
provisioningState | string | Provisioning state. Known values are: "Creating", "PendingBilling", "ConfirmedBilling", "Created", "Succeeded", "Cancelled", "Expired", and "Failed". (Creating, PendingBilling, ConfirmedBilling, Created, Succeeded, Cancelled, Expired, Failed) |
reason | object | The reason for the credit. Not required if not applicable. |
resourceId | string | Fully-qualified resource identifier of the resource. Format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BillingBenefits/{benefitType}/{benefitName}. |
sku | object | The resource model definition representing SKU. |
startAt | string (date-time) | Start DateTime. |
status | string | Status of the credit. Known values are: "Unknown", "Pending", "Active", "Succeeded", "Canceled", "Failed", "Expired", "Exhausted", and "NotStarted". (Unknown, Pending, Active, Succeeded, Canceled, Failed, Expired, Exhausted, NotStarted) |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
systemId | string | System identifier. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | resource_group_name, credit_name, subscription_id | Get a credit. | |
list_by_resource_group | select | resource_group_name, subscription_id | List Credits under a resource group from primary service admin. | |
list_by_subscription | select | subscription_id | List credits under a subscription from primary service tenant. | |
list_applicable | select | scope | List applicable credits for the provided scope. Currently supported scopes: BillingAccountResourceId. | |
create | insert | resource_group_name, credit_name, subscription_id, location | Create a credit. | |
update | update | resource_group_name, credit_name, subscription_id | Update a credit. | |
delete | delete | resource_group_name, credit_name, subscription_id | Delete a credit. | |
cancel | exec | resource_group_name, credit_name, subscription_id | Cancels a credit. |
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.
| Name | Datatype | Description |
|---|---|---|
credit_name | string | Name of the credit. Required. |
resource_group_name | string | The name of the resource group. The name is case insensitive. Required. |
scope | string | The scope at which the benefits are listed. Required. |
subscription_id | string |
SELECT examples
- get
- list_by_resource_group
- list_by_subscription
- list_applicable
Get a credit.
SELECT
id,
name,
billingAccountResourceId,
billingProfileResourceId,
breakdown,
credit,
customerId,
endAt,
etag,
identity,
kind,
location,
managedBy,
plan,
policies,
productCode,
provisioningState,
reason,
resourceId,
sku,
startAt,
status,
systemData,
systemId,
tags,
type
FROM azure.billing_benefits.credits
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND credit_name = '{{ credit_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
List Credits under a resource group from primary service admin.
SELECT
id,
name,
billingAccountResourceId,
billingProfileResourceId,
breakdown,
credit,
customerId,
endAt,
etag,
identity,
kind,
location,
managedBy,
plan,
policies,
productCode,
provisioningState,
reason,
resourceId,
sku,
startAt,
status,
systemData,
systemId,
tags,
type
FROM azure.billing_benefits.credits
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
List credits under a subscription from primary service tenant.
SELECT
id,
name,
billingAccountResourceId,
billingProfileResourceId,
breakdown,
credit,
customerId,
endAt,
etag,
identity,
kind,
location,
managedBy,
plan,
policies,
productCode,
provisioningState,
reason,
resourceId,
sku,
startAt,
status,
systemData,
systemId,
tags,
type
FROM azure.billing_benefits.credits
WHERE subscription_id = '{{ subscription_id }}' -- required
;
List applicable credits for the provided scope. Currently supported scopes: BillingAccountResourceId.
SELECT
id,
name,
billingAccountResourceId,
billingProfileResourceId,
breakdown,
credit,
customerId,
endAt,
etag,
identity,
kind,
location,
managedBy,
plan,
policies,
productCode,
provisioningState,
reason,
resourceId,
sku,
startAt,
status,
systemData,
systemId,
tags,
type
FROM azure.billing_benefits.credits
WHERE scope = '{{ scope }}' -- required
;
INSERT examples
- create
- Manifest
Create a credit.
INSERT INTO azure.billing_benefits.credits (
tags,
location,
properties,
managedBy,
kind,
identity,
sku,
plan,
resource_group_name,
credit_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ managedBy }}',
'{{ kind }}',
'{{ identity }}',
'{{ sku }}',
'{{ plan }}',
'{{ resource_group_name }}',
'{{ credit_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
etag,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: credits
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the credits resource.
- name: credit_name
value: "{{ credit_name }}"
description: Required parameter for the credits resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the credits resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
Credit properties.
value:
status: "{{ status }}"
productCode: "{{ productCode }}"
reason:
code: "{{ code }}"
description: "{{ description }}"
credit:
currencyCode: "{{ currencyCode }}"
amount: {{ amount }}
grain: "{{ grain }}"
startAt: "{{ startAt }}"
endAt: "{{ endAt }}"
policies:
redemption: "{{ redemption }}"
expiration: "{{ expiration }}"
billingAccountResourceId: "{{ billingAccountResourceId }}"
billingProfileResourceId: "{{ billingProfileResourceId }}"
breakdown:
- allocation:
currencyCode: "{{ currencyCode }}"
amount: {{ amount }}
grain: "{{ grain }}"
startAt: "{{ startAt }}"
endAt: "{{ endAt }}"
dimensions: "{{ dimensions }}"
provisioningState: "{{ provisioningState }}"
systemId: "{{ systemId }}"
customerId: "{{ customerId }}"
resourceId: "{{ resourceId }}"
- name: managedBy
value: "{{ managedBy }}"
description: |
The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource.
- name: kind
value: "{{ kind }}"
description: |
Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type. E.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
- name: identity
description: |
Managed service identity (system assigned and/or user assigned identities).
value:
principalId: "{{ principalId }}"
tenantId: "{{ tenantId }}"
type: "{{ type }}"
userAssignedIdentities: "{{ userAssignedIdentities }}"
- name: sku
description: |
The resource model definition representing SKU.
value:
name: "{{ name }}"
tier: "{{ tier }}"
size: "{{ size }}"
family: "{{ family }}"
capacity: {{ capacity }}
- name: plan
description: |
Plan for the resource.
value:
name: "{{ name }}"
publisher: "{{ publisher }}"
product: "{{ product }}"
promotionCode: "{{ promotionCode }}"
version: "{{ version }}"
UPDATE examples
- update
Update a credit.
UPDATE azure.billing_benefits.credits
SET
tags = '{{ tags }}',
properties = '{{ properties }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND credit_name = '{{ credit_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
etag,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type;
DELETE examples
- delete
Delete a credit.
DELETE FROM azure.billing_benefits.credits
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND credit_name = '{{ credit_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Lifecycle Methods
- cancel
Cancels a credit.
EXEC azure.billing_benefits.credits.cancel
@resource_group_name='{{ resource_group_name }}' --required,
@credit_name='{{ credit_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;