Views - Get By Scope
Gets the view for the defined scope by view name.
GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/views/{viewName}?api-version=2024-08-01
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
scope
|
path | True |
string |
The scope associated with view operations. 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 External Billing Account scope and 'providers/Microsoft.CostManagement/externalSubscriptions/{externalSubscriptionName}' for External Subscription scope. |
view
|
path | True |
string |
View name |
api-version
|
query | True |
string |
The API version to use for this operation. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
OK. The request has succeeded. |
|
Other Status Codes |
Error response describing why the operation failed. |
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name | Description |
---|---|
user_impersonation | impersonate your user account |
Examples
ResourceGroupView
Sample request
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample?api-version=2024-08-01
Sample response
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.CostManagement/views/swaggerExample",
"name": "swaggerExample",
"type": "Microsoft.CostManagement/Views",
"eTag": "\"1d4ff9fe66f1d10\"",
"properties": {
"displayName": "swagger Example",
"scope": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG",
"query": {
"type": "Usage",
"timeframe": "MonthToDate",
"dataSet": {
"granularity": "Daily",
"aggregation": {
"totalCost": {
"name": "PreTaxCost",
"function": "Sum"
}
},
"grouping": [],
"sorting": [
{
"direction": "Ascending",
"name": "UsageDate"
}
]
}
},
"chart": "Table",
"accumulated": "true",
"metric": "ActualCost",
"kpis": [
{
"type": "Forecast",
"id": null,
"enabled": true
},
{
"type": "Budget",
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MYDEVTESTRG/providers/Microsoft.Consumption/budgets/swaggerDemo",
"enabled": true
}
],
"pivots": [
{
"type": "Dimension",
"name": "ServiceName"
},
{
"type": "Dimension",
"name": "MeterCategory"
},
{
"type": "TagKey",
"name": "swaggerTagKey"
}
]
}
}
Definitions
Name | Description |
---|---|
Accumulated |
Show costs accumulated over time. |
Chart |
Chart type of the main view in Cost Analysis. Required. |
Error |
The details of the error. |
Error |
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. Some Error responses:
|
Function |
The name of the aggregation function to use. |
Kpi |
Each KPI must contain a 'type' and 'enabled' key. |
Kpi |
KPI type (Forecast, Budget). |
Metric |
Metric to use when displaying costs. |
Operator |
The operator to use for comparison. |
Pivot |
Each pivot must contain a 'type' and 'name'. |
Pivot |
Data type to show in view. |
Query |
The type of the column in the export. |
Report |
The aggregation expression to be used in the report. |
Report |
The comparison expression to be used in the report. |
Report |
The definition of data present in the report. |
Report |
The configuration of dataset in the report. |
Report |
The filter expression to be used in the report. |
Report |
The group by expression to be used in the report. |
Report |
The order by expression to be used in the report. |
Report |
Direction of sort. |
Report |
The start and end date for pulling data for the report. |
Report |
The granularity of rows in the report. |
Report |
The time frame for pulling data for the report. If custom, then a specific time period must be provided. |
Report |
The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates. |
View |
States and configurations of Cost Analysis. |
AccumulatedType
Show costs accumulated over time.
Name | Type | Description |
---|---|---|
false |
string |
|
true |
string |
ChartType
Chart type of the main view in Cost Analysis. Required.
Name | Type | Description |
---|---|---|
Area |
string |
|
GroupedColumn |
string |
|
Line |
string |
|
StackedColumn |
string |
|
Table |
string |
ErrorDetails
The details of the error.
Name | Type | Description |
---|---|---|
code |
string |
Error code. |
message |
string |
Error message indicating why the operation failed. |
ErrorResponse
Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.
Some Error responses:
429 TooManyRequests - Request is throttled. Retry after waiting for the time specified in the "x-ms-ratelimit-microsoft.consumption-retry-after" header.
503 ServiceUnavailable - Service is temporarily unavailable. Retry after waiting for the time specified in the "Retry-After" header.
Name | Type | Description |
---|---|---|
error |
The details of the error. |
FunctionType
The name of the aggregation function to use.
Name | Type | Description |
---|---|---|
Sum |
string |
KpiProperties
Each KPI must contain a 'type' and 'enabled' key.
Name | Type | Description |
---|---|---|
enabled |
boolean |
show the KPI in the UI? |
id |
string |
ID of resource related to metric (budget). |
type |
KPI type (Forecast, Budget). |
KpiTypeType
KPI type (Forecast, Budget).
Name | Type | Description |
---|---|---|
Budget |
string |
|
Forecast |
string |
MetricType
Metric to use when displaying costs.
Name | Type | Description |
---|---|---|
AHUB |
string |
|
ActualCost |
string |
|
AmortizedCost |
string |
OperatorType
The operator to use for comparison.
Name | Type | Description |
---|---|---|
Contains |
string |
|
In |
string |
PivotProperties
Each pivot must contain a 'type' and 'name'.
Name | Type | Description |
---|---|---|
name |
string |
Data field to show in view. |
type |
Data type to show in view. |
PivotTypeType
Data type to show in view.
Name | Type | Description |
---|---|---|
Dimension |
string |
|
TagKey |
string |
QueryColumnType
The type of the column in the export.
Name | Type | Description |
---|---|---|
Dimension |
string |
The dimension of cost data. |
TagKey |
string |
The tag associated with the cost data. |
ReportConfigAggregation
The aggregation expression to be used in the report.
Name | Type | Description |
---|---|---|
function |
The name of the aggregation function to use. |
|
name |
string |
The name of the column to aggregate. |
ReportConfigComparisonExpression
The comparison expression to be used in the report.
Name | Type | Description |
---|---|---|
name |
string |
The name of the column to use in comparison. |
operator |
The operator to use for comparison. |
|
values |
string[] |
Array of values to use for comparison |
ReportConfigDataset
The definition of data present in the report.
Name | Type | Description |
---|---|---|
aggregation |
<string,
Report |
Dictionary of aggregation expression to use in the report. The key of each item in the dictionary is the alias for the aggregated column. Report can have up to 2 aggregation clauses. |
configuration |
Has configuration information for the data in the report. The configuration will be ignored if aggregation and grouping are provided. |
|
filter |
Has filter expression to use in the report. |
|
granularity |
The granularity of rows in the report. |
|
grouping |
Array of group by expression to use in the report. Report can have up to 2 group by clauses. |
|
sorting |
Array of order by expression to use in the report. |
ReportConfigDatasetConfiguration
The configuration of dataset in the report.
Name | Type | Description |
---|---|---|
columns |
string[] |
Array of column names to be included in the report. Any valid report column name is allowed. If not provided, then report includes all columns. |
ReportConfigFilter
The filter expression to be used in the report.
Name | Type | Description |
---|---|---|
and |
The logical "AND" expression. Must have at least 2 items. |
|
dimensions |
Has comparison expression for a dimension |
|
or |
The logical "OR" expression. Must have at least 2 items. |
|
tags |
Has comparison expression for a tag |
ReportConfigGrouping
The group by expression to be used in the report.
Name | Type | Description |
---|---|---|
name |
string |
The name of the column to group. This version supports subscription lowest possible grain. |
type |
Has type of the column to group. |
ReportConfigSorting
The order by expression to be used in the report.
Name | Type | Description |
---|---|---|
direction |
Direction of sort. |
|
name |
string |
The name of the column to sort. |
ReportConfigSortingType
Direction of sort.
Name | Type | Description |
---|---|---|
Ascending |
string |
|
Descending |
string |
ReportConfigTimePeriod
The start and end date for pulling data for the report.
Name | Type | Description |
---|---|---|
from |
string |
The start date to pull data from. |
to |
string |
The end date to pull data to. |
ReportGranularityType
The granularity of rows in the report.
Name | Type | Description |
---|---|---|
Daily |
string |
|
Monthly |
string |
ReportTimeframeType
The time frame for pulling data for the report. If custom, then a specific time period must be provided.
Name | Type | Description |
---|---|---|
Custom |
string |
|
MonthToDate |
string |
|
WeekToDate |
string |
|
YearToDate |
string |
ReportType
The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates.
Name | Type | Description |
---|---|---|
Usage |
string |
View
States and configurations of Cost Analysis.
Name | Type | Description |
---|---|---|
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. |
id |
string |
Resource Id. |
name |
string |
Resource name. |
properties.accumulated |
Show costs accumulated over time. |
|
properties.chart |
Chart type of the main view in Cost Analysis. Required. |
|
properties.createdOn |
string |
Date the user created this view. |
properties.currency |
string |
Currency of the current view. |
properties.dateRange |
string |
Date range of the current view. |
properties.displayName |
string |
User input name of the view. Required. |
properties.kpis |
List of KPIs to show in Cost Analysis UI. |
|
properties.metric |
Metric to use when displaying costs. |
|
properties.modifiedOn |
string |
Date when the user last modified this view. |
properties.pivots |
Configuration of 3 sub-views in the Cost Analysis UI. |
|
properties.query.dataSet |
Has definition for data in this report config. |
|
properties.query.includeMonetaryCommitment |
boolean |
If true, report includes monetary commitment. |
properties.query.timePeriod |
Has time period for pulling data for the report. |
|
properties.query.timeframe |
The time frame for pulling data for the report. If custom, then a specific time period must be provided. |
|
properties.query.type |
The type of the report. Usage represents actual usage, forecast represents forecasted data and UsageAndForecast represents both usage and forecasted data. Actual usage and forecasted data can be differentiated based on dates. |
|
properties.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. |
type |
string |
Resource type. |