# Configure Azure Resources

## Enable a managed identity

If you have not already done so, enable a system-managed identity for the automation account.

* In the automation account, go to **Account Settings > Identity**
* In the **System assigned** tab, set the **Status** to **On**.

{% hint style="info" %}
You could also use a user-managed identity if you prefer.
{% endhint %}

## Enable Log Analytics workspace access for the managed identity

To allow the automation account to read and write data to the log analytics workspace, assign it the appropriate permission.

* In the Log Analytics workspace, go to the **Access control (IAM)** blade.
* Click **Add > Add role assignment**

<figure><img src="https://3886807721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWe9ieepRHnj7T8odXt%2Fuploads%2F4cBPogUQR6YE097b9pCH%2Fimage.png?alt=media&#x26;token=1bb060c3-42d9-45af-a6c8-7daa81d9ad75" alt=""><figcaption></figcaption></figure>

* Select the **Log Analytics Contributor** role and click **Next**
*

```
<figure><img src="https://3886807721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWe9ieepRHnj7T8odXt%2Fuploads%2FRHlhLHrtuyiiQ7nQGjAf%2Fimage.png?alt=media&#x26;token=f503535b-2bf0-428e-b80f-1c85e9de0d15" alt=""><figcaption></figcaption></figure>
```

* Next to **Assign access to**, select **Managed identity**, then click **Select members**

<figure><img src="https://3886807721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWe9ieepRHnj7T8odXt%2Fuploads%2FlMsauR4VWO3F1HrXlcXy%2Fimage.png?alt=media&#x26;token=5935e4fe-4bfa-449f-9701-7a57e848a8ba" alt=""><figcaption></figcaption></figure>

* Under **Managed identity**, select **Automation Account**

<figure><img src="https://3886807721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWe9ieepRHnj7T8odXt%2Fuploads%2FKbGjswaxR8HFQCBqQuQc%2Fimage.png?alt=media&#x26;token=d7b74e5a-3f50-4973-be3a-bda8a46e05a6" alt=""><figcaption></figcaption></figure>

* Select the automation account from the list and click **Select.**
* Click **Review + assign** twice to finish.

## Log Analytics data retention

By default, a log analytics workspace in the Pay as you go tier includes 31 days of free data retention. If you wish, you can increase this, but there are some things to consider if doing so:

* You will be charged for data retention beyond the free 31 days
* The retention period affects how much historic data you will be able to see in your software updates report, for example in the trend charts.
* Longer retention times means your report queries will need to process more data and return more rows and increases the risk of hitting API service limits.

To change the data retention period:

* In the Log Analytics workspace, go to **General > Usage and estimated costs**
* Click **Data retention** at the top
* Set the desired retention period and click **OK**.

<figure><img src="https://3886807721-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWe9ieepRHnj7T8odXt%2Fuploads%2Fg0DueNpaVt0A2WSz0T7N%2Fimage.png?alt=media&#x26;token=bbdfb0e4-ce0c-45d4-aa85-66ce874b2dc1" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you are willing to pay for it, a 60-day retention period is recommended.
{% endhint %}
