views
Creates, updates, deletes, gets or lists a views resource.
Overview
| Name | views |
| Type | Resource |
| Id | azure.cost_management.views |
Fields
The following fields are returned by SELECT queries:
- get_by_scope
- get
- list_by_scope
- list
| 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. |
accumulated | string | Show costs accumulated over time. Known values are: "true" and "false". (true, false) |
chart | string | Chart type of the main view in Cost Analysis. Required. Known values are: "Area", "Line", "StackedColumn", "GroupedColumn", and "Table". (Area, Line, StackedColumn, GroupedColumn, Table) |
createdOn | string (date-time) | Date the user created this view. |
currency | string | Currency of the current view. |
dateRange | string | Date range of the current view. |
displayName | string | User input name of the view. Required. |
eTag | string | eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. |
kpis | array | List of KPIs to show in Cost Analysis UI. |
metric | string | Metric to use when displaying costs. Known values are: "ActualCost", "AmortizedCost", and "AHUB". (ActualCost, AmortizedCost, AHUB) |
modifiedOn | string (date-time) | Date when the user last modified this view. |
pivots | array | Configuration of 3 sub-views in the Cost Analysis UI. |
query | object | Query body configuration. Required. |
scope | string | Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
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. |
accumulated | string | Show costs accumulated over time. Known values are: "true" and "false". (true, false) |
chart | string | Chart type of the main view in Cost Analysis. Required. Known values are: "Area", "Line", "StackedColumn", "GroupedColumn", and "Table". (Area, Line, StackedColumn, GroupedColumn, Table) |
createdOn | string (date-time) | Date the user created this view. |
currency | string | Currency of the current view. |
dateRange | string | Date range of the current view. |
displayName | string | User input name of the view. Required. |
eTag | string | eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. |
kpis | array | List of KPIs to show in Cost Analysis UI. |
metric | string | Metric to use when displaying costs. Known values are: "ActualCost", "AmortizedCost", and "AHUB". (ActualCost, AmortizedCost, AHUB) |
modifiedOn | string (date-time) | Date when the user last modified this view. |
pivots | array | Configuration of 3 sub-views in the Cost Analysis UI. |
query | object | Query body configuration. Required. |
scope | string | Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
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. |
accumulated | string | Show costs accumulated over time. Known values are: "true" and "false". (true, false) |
chart | string | Chart type of the main view in Cost Analysis. Required. Known values are: "Area", "Line", "StackedColumn", "GroupedColumn", and "Table". (Area, Line, StackedColumn, GroupedColumn, Table) |
createdOn | string (date-time) | Date the user created this view. |
currency | string | Currency of the current view. |
dateRange | string | Date range of the current view. |
displayName | string | User input name of the view. Required. |
eTag | string | eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. |
kpis | array | List of KPIs to show in Cost Analysis UI. |
metric | string | Metric to use when displaying costs. Known values are: "ActualCost", "AmortizedCost", and "AHUB". (ActualCost, AmortizedCost, AHUB) |
modifiedOn | string (date-time) | Date when the user last modified this view. |
pivots | array | Configuration of 3 sub-views in the Cost Analysis UI. |
query | object | Query body configuration. Required. |
scope | string | Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
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. |
accumulated | string | Show costs accumulated over time. Known values are: "true" and "false". (true, false) |
chart | string | Chart type of the main view in Cost Analysis. Required. Known values are: "Area", "Line", "StackedColumn", "GroupedColumn", and "Table". (Area, Line, StackedColumn, GroupedColumn, Table) |
createdOn | string (date-time) | Date the user created this view. |
currency | string | Currency of the current view. |
dateRange | string | Date range of the current view. |
displayName | string | User input name of the view. Required. |
eTag | string | eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. |
kpis | array | List of KPIs to show in Cost Analysis UI. |
metric | string | Metric to use when displaying costs. Known values are: "ActualCost", "AmortizedCost", and "AHUB". (ActualCost, AmortizedCost, AHUB) |
modifiedOn | string (date-time) | Date when the user last modified this view. |
pivots | array | Configuration of 3 sub-views in the Cost Analysis UI. |
query | object | Query body configuration. Required. |
scope | string | Cost Management scope to save the view on. This includes 'subscriptions/{subscriptionId}' for subscription scope, 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for resourceGroup scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}' for Billing Account scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/departments/{departmentId}' for Department scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/enrollmentAccounts/{enrollmentAccountId}' for EnrollmentAccount scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/billingProfiles/{billingProfileId}' for BillingProfile scope, 'providers/Microsoft.Billing/billingAccounts/{billingAccountId}/invoiceSections/{invoiceSectionId}' for InvoiceSection scope, 'providers/Microsoft.Management/managementGroups/{managementGroupId}' for Management Group scope, '/providers/Microsoft.CostManagement/externalBillingAccounts/{externalBillingAccountName}' for ExternalBillingAccount scope, and '/providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for ExternalSubscription scope. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
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_by_scope | select | scope, view_name | Gets the view for the defined scope by view name. | |
get | select | view_name | Gets the view by view name. | |
list_by_scope | select | scope | Lists all views at the given scope. | |
list | select | Lists all views by tenant and object. | ||
create_or_update_by_scope | insert | scope, view_name | The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. | |
create_or_update | insert | view_name | The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. | |
create_or_update_by_scope | replace | scope, view_name | The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. | |
create_or_update | replace | view_name | The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. | |
delete_by_scope | delete | scope, view_name | The operation to delete a view. | |
delete | delete | view_name | The operation to delete a view. |
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 |
|---|---|---|
scope | string | undefined. Required. |
view_name | string | View name. Required. |
SELECT examples
- get_by_scope
- get
- list_by_scope
- list
Gets the view for the defined scope by view name.
SELECT
id,
name,
accumulated,
chart,
createdOn,
currency,
dateRange,
displayName,
eTag,
kpis,
metric,
modifiedOn,
pivots,
query,
scope,
systemData,
type
FROM azure.cost_management.views
WHERE scope = '{{ scope }}' -- required
AND view_name = '{{ view_name }}' -- required
;
Gets the view by view name.
SELECT
id,
name,
accumulated,
chart,
createdOn,
currency,
dateRange,
displayName,
eTag,
kpis,
metric,
modifiedOn,
pivots,
query,
scope,
systemData,
type
FROM azure.cost_management.views
WHERE view_name = '{{ view_name }}' -- required
;
Lists all views at the given scope.
SELECT
id,
name,
accumulated,
chart,
createdOn,
currency,
dateRange,
displayName,
eTag,
kpis,
metric,
modifiedOn,
pivots,
query,
scope,
systemData,
type
FROM azure.cost_management.views
WHERE scope = '{{ scope }}' -- required
;
Lists all views by tenant and object.
SELECT
id,
name,
accumulated,
chart,
createdOn,
currency,
dateRange,
displayName,
eTag,
kpis,
metric,
modifiedOn,
pivots,
query,
scope,
systemData,
type
FROM azure.cost_management.views
;
INSERT examples
- create_or_update_by_scope
- create_or_update
- Manifest
The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.
INSERT INTO azure.cost_management.views (
properties,
eTag,
scope,
view_name
)
SELECT
'{{ properties }}',
'{{ eTag }}',
'{{ scope }}',
'{{ view_name }}'
RETURNING
id,
name,
eTag,
properties,
systemData,
type
;
The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.
INSERT INTO azure.cost_management.views (
properties,
eTag,
view_name
)
SELECT
'{{ properties }}',
'{{ eTag }}',
'{{ view_name }}'
RETURNING
id,
name,
eTag,
properties,
systemData,
type
;
# Description fields are for documentation purposes
- name: views
props:
- name: scope
value: "{{ scope }}"
description: Required parameter for the views resource.
- name: view_name
value: "{{ view_name }}"
description: Required parameter for the views resource.
- name: properties
description: |
The properties of the view.
value:
displayName: "{{ displayName }}"
scope: "{{ scope }}"
createdOn: "{{ createdOn }}"
modifiedOn: "{{ modifiedOn }}"
dateRange: "{{ dateRange }}"
currency: "{{ currency }}"
query:
type: "{{ type }}"
timeframe: "{{ timeframe }}"
timePeriod:
from: "{{ from }}"
to: "{{ to }}"
dataSet:
granularity: "{{ granularity }}"
configuration:
columns:
- "{{ columns }}"
aggregation: "{{ aggregation }}"
grouping:
- type: "{{ type }}"
name: "{{ name }}"
sorting:
- direction: "{{ direction }}"
name: "{{ name }}"
filter:
and:
- and: "{{ and }}"
or: "{{ or }}"
dimensions:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
tags:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
or:
- and: "{{ and }}"
or: "{{ or }}"
dimensions:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
tags:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
dimensions:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
tags:
name: "{{ name }}"
operator: "{{ operator }}"
values: "{{ values }}"
includeMonetaryCommitment: {{ includeMonetaryCommitment }}
chart: "{{ chart }}"
accumulated: "{{ accumulated }}"
metric: "{{ metric }}"
kpis:
- type: "{{ type }}"
id: "{{ id }}"
enabled: {{ enabled }}
pivots:
- type: "{{ type }}"
name: "{{ name }}"
- name: eTag
value: "{{ eTag }}"
description: |
eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not.
REPLACE examples
- create_or_update_by_scope
- create_or_update
The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.
REPLACE azure.cost_management.views
SET
properties = '{{ properties }}',
eTag = '{{ eTag }}'
WHERE
scope = '{{ scope }}' --required
AND view_name = '{{ view_name }}' --required
RETURNING
id,
name,
eTag,
properties,
systemData,
type;
The operation to create or update a view. Update operation requires latest eTag to be set in the request. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag.
REPLACE azure.cost_management.views
SET
properties = '{{ properties }}',
eTag = '{{ eTag }}'
WHERE
view_name = '{{ view_name }}' --required
RETURNING
id,
name,
eTag,
properties,
systemData,
type;
DELETE examples
- delete_by_scope
- delete
The operation to delete a view.
DELETE FROM azure.cost_management.views
WHERE scope = '{{ scope }}' --required
AND view_name = '{{ view_name }}' --required
;
The operation to delete a view.
DELETE FROM azure.cost_management.views
WHERE view_name = '{{ view_name }}' --required
;