# Add role assignments to the storage account/s

Before the solution can backup your storage tables, it needs to be granted access to the storage account containing the Azure tables that you want to backup. Specifically, the system managed identity of the function app needs to be granted the **Storage Table Data Reader** and **Storage Blob Data Contributor** roles to the storage account.

The script below can do this for you. You'll need to run this against every storage account where you are backing up tables.

{% embed url="<https://github.com/SMSAgentSoftware/AzureTableBackup/blob/main/Add-AzStorageAccountRoleAssigments.ps1>" %}

Download the script and set the parameters at the top of the script:

* **Tenant** (tenant Id)
* **Subscription** (subscription name)
* **StorageAccountName** (the name of the storage account containing the tables you want to backup)

<figure><img src="/files/5kii23XrR9lzmvnsXGeY" alt=""><figcaption></figcaption></figure>

Execute the script, and upon successful execution the new role assigments will be reported:

<figure><img src="/files/Q3xfVOYoYE3TL0ZKjgOV" alt=""><figcaption></figcaption></figure>

In the storage account in the Azure portal, in the **Access Control (IAM)** blade, in the **Role assignments** tab, you will see the new role assignments added.

<figure><img src="/files/eab5TPGP4xsrolNQuezT" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.smsagent.blog/azure-solutions/automated-azure-table-storage-backups/deploy-the-solution/add-role-assignments-to-the-storage-account-s.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
