Skip to main content

policies

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

Overview

Namepolicies
TypeResource
Idazure.billing.policies

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.
policiesarrayList of all policies defined at the billing scope.
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)
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 < > % & \ ? /.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".
viewChargesstringThe policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Required. Known values are: "Other", "Allowed", and "NotAllowed". (Other, Allowed, NotAllowed)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_customerselectbilling_account_name, billing_profile_name, customer_name, policy_nameLists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
get_by_customer_at_billing_accountselectbilling_account_name, customer_nameLists the policies for a customer at billing account scope. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
get_by_billing_profileselectbilling_account_name, billing_profile_nameLists the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
get_by_billing_accountselectbilling_account_nameGet the policies for a billing account of Enterprise Agreement type.
get_by_subscriptionselectsubscription_idLists the policies that are managed by the Billing Admin for the defined subscriptions. This is supported for Microsoft Online Services Program, Microsoft Customer Agreement and Microsoft Partner Agreement.
create_or_update_by_customerinsertbilling_account_name, billing_profile_name, customer_nameUpdates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
create_or_update_by_customer_at_billing_accountinsertbilling_account_name, customer_nameUpdates the policies for a customer at billing account scope. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
create_or_update_by_billing_profileinsertbilling_account_name, billing_profile_nameUpdates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
create_or_update_by_billing_accountinsertbilling_account_nameUpdate the policies for a billing account of Enterprise Agreement type.
create_or_update_by_customerreplacebilling_account_name, billing_profile_name, customer_nameUpdates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
create_or_update_by_customer_at_billing_accountreplacebilling_account_name, customer_nameUpdates the policies for a customer at billing account scope. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.
create_or_update_by_billing_profilereplacebilling_account_name, billing_profile_nameUpdates the policies for a billing profile. This operation is supported only for billing accounts with agreement type Microsoft Customer Agreement.
create_or_update_by_billing_accountreplacebilling_account_nameUpdate the policies for a billing account of Enterprise Agreement type.

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.
billing_profile_namestringThe ID that uniquely identifies a billing profile. Required.
customer_namestringThe ID that uniquely identifies a customer. Required.
policy_namestringService-defined resource names such as 'default' which are reserved resource names. "default" Required.
subscription_idstring

SELECT examples

Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.

SELECT
id,
name,
policies,
provisioningState,
systemData,
tags,
type,
viewCharges
FROM azure.billing.policies
WHERE billing_account_name = '{{ billing_account_name }}' -- required
AND billing_profile_name = '{{ billing_profile_name }}' -- required
AND customer_name = '{{ customer_name }}' -- required
AND policy_name = '{{ policy_name }}' -- required
;

INSERT examples

Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.

INSERT INTO azure.billing.policies (
properties,
tags,
billing_account_name,
billing_profile_name,
customer_name
)
SELECT
'{{ properties }}',
'{{ tags }}',
'{{ billing_account_name }}',
'{{ billing_profile_name }}',
'{{ customer_name }}'
RETURNING
id,
name,
properties,
systemData,
tags,
type
;

REPLACE examples

Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement.

REPLACE azure.billing.policies
SET
properties = '{{ properties }}',
tags = '{{ tags }}'
WHERE
billing_account_name = '{{ billing_account_name }}' --required
AND billing_profile_name = '{{ billing_profile_name }}' --required
AND customer_name = '{{ customer_name }}' --required
RETURNING
id,
name,
properties,
systemData,
tags,
type;