Skip to main content

views

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

Overview

Nameviews
TypeResource
Idazure.cost_management.views

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.
accumulatedstringShow costs accumulated over time. Known values are: "true" and "false". (true, false)
chartstringChart type of the main view in Cost Analysis. Required. Known values are: "Area", "Line", "StackedColumn", "GroupedColumn", and "Table". (Area, Line, StackedColumn, GroupedColumn, Table)
createdOnstring (date-time)Date the user created this view.
currencystringCurrency of the current view.
dateRangestringDate range of the current view.
displayNamestringUser input name of the view. Required.
eTagstringeTag 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.
kpisarrayList of KPIs to show in Cost Analysis UI.
metricstringMetric to use when displaying costs. Known values are: "ActualCost", "AmortizedCost", and "AHUB". (ActualCost, AmortizedCost, AHUB)
modifiedOnstring (date-time)Date when the user last modified this view.
pivotsarrayConfiguration of 3 sub-views in the Cost Analysis UI.
queryobjectQuery body configuration. Required.
scopestringCost 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.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_scopeselectscope, view_nameGets the view for the defined scope by view name.
getselectview_nameGets the view by view name.
list_by_scopeselectscopeLists all views at the given scope.
listselectLists all views by tenant and object.
create_or_update_by_scopeinsertscope, view_nameThe 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_updateinsertview_nameThe 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_scopereplacescope, view_nameThe 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_updatereplaceview_nameThe 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_scopedeletescope, view_nameThe operation to delete a view.
deletedeleteview_nameThe 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.

NameDatatypeDescription
scopestringundefined. Required.
view_namestringView name. Required.

SELECT examples

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
;

INSERT examples

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
;

REPLACE examples

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;

DELETE examples

The operation to delete a view.

DELETE FROM azure.cost_management.views
WHERE scope = '{{ scope }}' --required
AND view_name = '{{ view_name }}' --required
;