# Azure EA

## Introduction

When deploying the Azure EA [Extraction template](https://github.com/exivity/templates/blob/master/Azure%20EA/Azure_EA.use) for Exivity, some configuration is required within your Azure EA environment. The following process must be completed in order to report on Azure EA consumption:

1. Create an Access Key and Secret in your Azure EA portal
2. Configure the Azure EA Extractor
3. Configure your Azure EA Transformer
4. Create a Report definition

### Creating an Access Key & Secret

In order for Exivity to authenticate with Azure EA, you will need to create an access key and secret in the Azure EA Portal. Also you will need to find your enrollment number. To do this, login to your Azure EA Portal on <https://ea.azure.com> and navigate to the ***Reports*** menu:

![Creating an API Access Key & Secret for your Azure EA environment](https://2905039365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LaVJjNb4zIUj8OVh_0k%2F-LaVMDuN4mCyCkkKdx0H%2Fimage.png?alt=media\&token=56a376aa-651e-43a5-aa5d-126c5238cb25)

Just under the Windows logo in the left menu section you will find your **enrollment number** which you will need to provide later when configuring the Extractor. To create the Access Key & Secret, click on *Download Usage* and then on *API Access Key*. This brings you to the menu where you can manage your Access Keys and corresponding secret which you will need in order to configure the data Extractor.

### Configure Extractor

To create the Extractor, browse to **Data Sources > Extractors** in the Exivity GUI and click the **Create Extractor** button. This will try to connect to the Exivity Github account to obtain a list of available templates. For Azure EA:

* Pick [Azure EA](https://github.com/exivity/templates/blob/master/Azure%20EA/Azure_EA.use) from the list
* Provide a name for the Extractor in the **name** field
* Click the **Create** button.

Once you've created the Extractor, go to first tab: *Variables*

![Azure EA Extraction Template](https://2905039365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LaVJjNb4zIUj8OVh_0k%2F-LaVO33uLzC00j0tmeSH%2Fimage.png?alt=media\&token=0b1db776-4f0b-4489-a06f-f028a15ca692)

Fill in all variables in above screenshot, and feel free to *encrypt* any sensitive data using the lock symbol on the right.

Once you've filled in all details, go to the **Run** tab to execute the Extractor for a single day:

![Executing the Extractor manually for a single day](https://2905039365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LKvvTQII_LM3fkQhXOt%2F-LKvwzr9Mp0tT8HakDaB%2Fimage.png?alt=media\&token=3a757427-1e9c-48de-baa6-5b2bcf01cec6)

The Extractor requires two parameters in yyyyMMdd format:

* **from\_date** is the date for which you wish to collect consumption data
* **to\_date** should be the date immediately following **from\_date**

These should be specified as shown in the screenshot above, separated with a space.

When you click the *Run Now* button, you should get a successful result.

### Configure Transformer

Once you have successfully run your Azure EA Blob Extractor, you can create a Transformer template via **Data Sources > Transformers** in the Exivity GUI. Browse to this location and click the **Create Transformer** button. Make any changes that you feel necessary and then select the **run** tab to execute it for a single day as a test.

{% hint style="warning" %}
Make sure that when running the Transformer you select **custom range** in the drop-down menu labelled **Run for** and select the same day as for which you have extracted consumption data in the previous step.
{% endhint %}

### Create a Report

Once you have run both your Extractor and Transformer successfully create a *Report Definition* via the menu option **Reports > Definitions***:*

![Creating a Report Definition](https://2905039365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LKvvTQII_LM3fkQhXOt%2F-LKvyackYSXxMCLS_qGR%2Fimage.png?alt=media\&token=f65cc274-2b2f-4876-8ab0-2f8b49ce887e)

Select the column(s) by which you would like to break down the costs. Once you have created the report, you should then click the *Prepare Report* button after first making sure you have selected a valid date range from the date selector shown when preparing the report.

![Prepare your Report](https://2905039365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LHEKskLK6aXinV75Knl%2F-LKvvTQII_LM3fkQhXOt%2F-LKvzU8fWwJLa9Gs1DUw%2Fimage.png?alt=media\&token=4eaa51c9-e558-42df-ae92-55807eab3807)

Once this is done you should be able to run any of **Accounts**, **Instances**, **Services** or **Invoices** report types located under the **Report** menu for the date range you prepared the report for.
