Microsoft Azure - Cost and Usage Extractor
Use the Microsoft Azure - Cost and Usage Extractor to collect the cost and usage data of the virtual machines that are provisioned in the Azure cloud. TrueSight Cloud Cost Control uses this resource usage and cost data to provide forecasting, simulated migration, and cost estimations.
The ETL makes calls to the billing REST APIs to retrieve the cost and usage data. For information about these API calls, see API calls for the Azure Cost and Usage ETL.
This ETL works in conjunction with the Microsoft-Azure-Azure-API-Extractor (Resource Manager model). The cost and usage data that is collected is associated with the corresponding business services and entities that the Azure API ETL collects.
To learn more about the collection of business service data by ETLs, see Collecting-business-service-data.
You can configure the ETL to collect data from the following types of Azure subscriptions:
- Pay-As-You-Go
- Enterprise Agreement (Supported in TrueSight Capacity Optimization version 11.3.01.001 or later)
Collecting data by using the Azure Cost and Usage ETL
To collect data by using the Azure Cost and Usage ETL, do the following tasks:
I. Complete the preconfiguration tasks.
II. Configure the ETL.
III. Run the ETL.
Step I. Complete the preconfiguration tasks
For the Pay-As-You-Go Azure subscription
To collect the billing details of your Azure resources, the ETL needs to make the REST API calls to Azure services. To authenticate with these APIs, you must specify the following details during the ETL configuration:
- Azure subscription ID
- Azure offer ID
- Azure Active Directory (AAD) tenant ID
- Application ID
- Authentication key
- Business service tag key
To fetch these details, complete the following preconfiguration tasks:
For the Enterprise Agreement Azure subscription
To collect the billing details of your Azure resources, the ETL needs to access the billing API. To authenticate with the billing API, you must specify the following details during the ETL configuration:
- Enrollment number
- API access key
To fetch these details, complete the following preconfiguration tasks:
Step II. Configure the ETL
You must configure the ETL to connect to Azure for collecting the cost and usage data of Azure entities. ETL configuration includes specifying the basic and optional advanced properties. While configuring the basic properties is sufficient, you can optionally configure the advanced properties for additional customization.
A. Configuring the basic properties
Some of the basic properties display default values. You can modify these values if required.
To configure the basic properties:
- In the TrueSight Capacity Optimization console, navigate to Administration > ETL & System Tasks, and select ETL tasks.
- On the ETL tasks page, click Add > Add ETL. The Add ETL page displays the configuration properties. You must configure properties in the following tabs: Run configuration, Entity catalog, and Microsoft Azure Connection.
- On the Run configuration tab, select Microsoft Azure - Cost and Usage Extractor from the ETL module list. The name of the ETL is displayed in the ETL Task name field. You can edit this field to customize the name.
- Click the Entity catalog tab, and select one of the following options:
- Shared Entity Catalog: Retain the default selection to share the entity catalog with the Azure API ETL.
- From the Sharing with Entity Catalog list, select the entity catalog name that is shared between ETLs.
- Private Entity Catalog: Select if this is the only ETL that extracts data from the Azure resources.
- Shared Entity Catalog: Retain the default selection to share the entity catalog with the Azure API ETL.
Click the Microsoft Azure Connection tab.
If you are using EA Azure subscriptions, configure the following properties to import the cost and usage details from these subscriptions:Property
Description
Enterprise Agreement account
Select Yes.
Enrollment number
Specify the enrollment number that you obtained from Microsoft.
API access key
Specify the API access key that you obtained during the preconfiguration tasks.
If you are using Pay-As-You-Go Azure subscriptions, configure the following properties to import the cost and usage data from these subscriptions.
Property
Description
Enterprise Agreement account
Select No.
Subscription access mode
Depending on your Azure subscription mode, select Single or Multiple. You must use the values that you obtained during the preconfiguration procedure.
- For a single subscription, specify the following details:
- ID of the subscription for which you want to retrieve data.
- Azure pricing offer ID. The Offer ID code format consists of the “MS-AZR-“ prefix plus the unique Offer ID number.
- For multiple subscriptions, specify the path of the file (.txt or .csv) that contains the subscription ID of all the subscriptions for which you want to retrieve the cost and usage data. The file contains the subscription ID and pricing offer ID, separated by a semi-colon (;), for each subscription:
Tenant ID
Specify the Directory ID from your Active Directory properties.
Application ID
Specify the Application ID from App registrations in the Azure Active Directory.
Authentication key
Specify the authentication key that you generated after creating the web application in the Azure Active Directory.
Business Service Tag Key
Specify the business service tag key that you used in the Azure API ETL for collecting business service data. The Microsoft Azure - Azure API extractor creates business service entities in the Workspace, and maps resources to each business service. The Microsoft Azure - Cost and Usage Extractor associates the cost of a resource under a specific business service by using the tags of collected resources.
The default tag key is Service.Use proxy
Specify whether you want to configure a proxy server, and provide the following details. The default selection is No.
- The fully qualified domain name and the port number of the proxy server host.
- The protocol for communicating with the proxy server. The default protocol is HTTPS.
- If the proxy server requires authentication, select Yes, and specify the proxy server user name and password.
Additionally, configure the following properties:
Property
Description
Business Service Tag Key
Specify the business service tag key that you used in the Azure API ETL for collecting business service data. The Microsoft Azure - Azure API extractor creates business service entities in the Workspace, and maps resources to each business service. The Microsoft Azure - Cost and Usage Extractor associates the cost of a resource under a specific business service by using the tags of collected resources.
The default tag key is Service.Use proxy
Specify whether you want to configure a proxy server, and provide the following details. The default selection is No.
- The fully qualified domain name and the port number of the proxy server host.
- The protocol for communicating with the proxy server. The default protocol is HTTPS.
- If the proxy server requires authentication, select Yes, and specify the proxy server user name and password.
- For a single subscription, specify the following details:
(Optional) Override the default values of properties in the following tabs:
- Click Save.
The ETL tasks page shows the details of the newly configured Azure Cost and Usage ETL.
(Optional) B. Configuring the advanced properties
You can configure the advanced properties to change the way the ETL works or to define a period for data collection.
To configure the advanced properties:
- On the Add ETL page, click Advanced.
Configure the following properties:
- Click Save.
The ETL tasks page shows the details of the newly configured Azure Cost and Usage ETL.
Step III. Run the ETL
After you configure the ETL, you can run it to collect data. You can run the ETL in the following modes:A. Simulation mode: Only validates connection to the data source, does not collect data. Use this mode when you want to run the ETL for the first time or after you make any changes to the ETL configuration.B. Production mode: Collects data from the data source.
A. Running the ETL in the simulation mode
To run the ETL in the simulation mode:
- In the TrueSight Capacity Optimization console, navigate to Administration > ETL & System Tasks, and select ETL tasks.
- On the ETL tasks page, click the ETL. The ETL details are displayed.
- In the Run configurations table, click Edit
to modify the ETL configuration settings.
- On the Run configuration tab, ensure that the Execute in simulation mode option is set to Yes, and click Save.
- Click Run active configuration. A confirmation message about the ETL run job submission is displayed.
- On the ETL tasks page, check the ETL run status in the Last exit column.
OK Indicates that the ETL ran without any error. You are ready to run the ETL in the production mode. - If the ETL run status is Warning, Error, or Failed:
- On the ETL tasks page, click
in the last column of the ETL name row.
- Check the log and reconfigure the ETL if required.
- Run the ETL again.
- Repeat these steps until the ETL run status changes to OK.
- On the ETL tasks page, click
B. Running the ETL in the production mode
You can run the ETL manually when required or schedule it to run at a specified time.
Running the ETL manually
- On the ETL tasks page, click the ETL. The ETL details are displayed.
- In the Run configurations table, click Edit
to modify the ETL configuration settings. The Edit run configuration page is displayed.
- On the Run configuration tab, select No for the Execute in simulation mode option, and click Save.
- To run the ETL immediately, click Run active configuration. A confirmation message about the ETL run job submission is displayed.
When the ETL is run, it collects data from the source and transfers it to the TrueSight Capacity Optimization database.
Scheduling the ETL run
By default, the ETL is scheduled to run daily. You can customize this schedule by changing the frequency and period of running the ETL.
To configure the ETL run schedule:
- On the ETL tasks page, click the ETL, and click Edit. The ETL details are displayed.
- On the Edit task page, do the following, and click Save:
- Specify a unique name and description for the ETL task.
- In the Maximum execution time before warning field, specify the duration for which the ETL must run before generating warnings or alerts, if any.
- Select a predefined or custom frequency for starting the ETL run. The default selection is Predefined.
- Select the task group and the scheduler to which you want to assign the ETL task.
- Click Schedule. A message confirming the scheduling job submission is displayed.
When the ETL runs as scheduled, it collects data from the source and transfers it to the TrueSight Capacity Optimization database.
Step IV. Verify data collection
Verify that the ETL ran successfully and the Azure cost data is refreshed in the TrueSight console.
To verify whether the ETL ran successfully:
- In the TrueSight Capacity Optimization console, click Administration > ETL and System Tasks > ETL tasks.
- In the Last exec time column corresponding to the ETL name, verify that the current date and time are displayed.
To verify whether the Azure cost data is refreshed:
- Log in to the TrueSight console.
- Click Cloud Cost Control, and verify whether the Azure cost data is refreshed.
API calls for the Pay-As-You-Go Azure subscriptions
The ETL makes the following calls to the Azure Billing REST API to retrieve data from your Pay-As-You-Go Azure subscriptions.
Task | Resource Management API call |
---|---|
Authentication | POST https://login.windows.net/<tenant_id>/oauth2/token (Application ID, Authentication key) |
List all subscription details | |
Get resource rate card | GET https://management.azure.com/subscriptions/<Subscription_ID>/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq 'Offer Code' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'
|
Get resource usage | GET https://management.azure.com/subscriptions/<Subscription ID>/providers/Microsoft.Commerce/UsageAggregates?api-version=2015-06-01-preview&reportedStartTime=<Reported start date>&reportedEndTime=<Reported end date>&aggregationGranularity=Daily |
Get consumption data for enrollment number |
API calls for the Enterprise Agreement Azure subscriptions
The ETL makes the following call to the Azure consumption REST API to retrieve data from your EA subscriptions.
Task | Resource Management API call |
---|---|
Get consumption data for enrollment number |
For more information, see the Microsoft Azure Billing API Documentation.