# Microsoft Azure Blob Retention Policy

## Overview <a href="#overview" id="overview"></a>

To manage Azure Blob retention policies via WebAPI, you must obtain the following credentials:

1. **Tenant ID**
2. **Client ID**
3. **Client Secret**
4. **Access Token**

These values are required to authenticate and interact with Azure endpoints for retention policy operations.

***

## What Is a Tenant and How to Get a Tenant ID in Azure? <a href="#what-is-tenant-and-how-to-get-a-tenant-id-in-azure" id="what-is-tenant-and-how-to-get-a-tenant-id-in-azure"></a>

A tenant represents your organization in Microsoft cloud services.

To get your **Tenant ID**:

1. Log in to the [Azure portal](https://portal.azure.com/).
2. Go to **Entra ID > Properties**.
3. Copy the value from the **Directory ID** field — this is your Tenant ID.

To create a new tenant:

1. Select **Create a resource**.
2. Search for and select **Entra ID**.
3. Provide a name for your new directory.
4. A **Tenant ID** will be auto-generated.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FZqGBSyTviStg694kuvj0%2Fimage.png?alt=media&#x26;token=a988ffa3-963a-485e-96ed-400a60594abd" alt="Azure portal - create a new Entra ID tenant"><figcaption><p>Create New Tenant</p></figcaption></figure>

***

## What Is a Client ID and How to Create It? <a href="#what-is-client-id-and-how-to-create-it" id="what-is-client-id-and-how-to-create-it"></a>

A **Client ID** (or Application ID) identifies your app to Azure AD.

To generate it:

1. Go to your Azure directory.
2. Click **App registrations > New registration**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FDlhHUdPLJ1vnMf9DeUWH%2Fimage.png?alt=media&#x26;token=a195426d-d033-44ea-b60b-70557d0062f1" alt="New App Registration" width="563"><figcaption><p>App Registration</p></figcaption></figure>

3. Select the **Single-tenant** option and click **Register**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FB6k35ArHxrjuxfAxPNlu%2Fimage.png?alt=media&#x26;token=4f345b2b-77fd-47c3-9ebc-65c0de7c8e6b" alt="Single tenant registration" width="544"><figcaption><p>Choose Single-Tenant</p></figcaption></figure>

4. Go to **Authentication**, select app type as **Web**, and configure redirect URI.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FTpVilNIBj4JVm161K6Kq%2Fimage.png?alt=media&#x26;token=f3e3af66-0b36-410f-a75a-a3c310aafb54" alt="Authentication tab configuration" width="563"><figcaption><p>Configure Authentication</p></figcaption></figure>

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2F96HXtzXdzNwhB43X33RA%2Fimage.png?alt=media&#x26;token=1f4d1d6e-007e-438b-8338-63983ebe856f" alt="Add redirect URI" width="563"><figcaption><p>Web Redirect URI</p></figcaption></figure>

5. The app will now show an **Application ID** — this is your **Client ID**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2Fkvh3lWNYktVQkCF7ZcMc%2Fimage.png?alt=media&#x26;token=72f83806-6dad-4ed8-85cb-700344c33d35" alt="Application ID shown in portal" width="563"><figcaption><p>Client ID (Application ID)</p></figcaption></figure>

***

## Add a Client Secret <a href="#add-a-client-secret" id="add-a-client-secret"></a>

To create a **Client Secret**:

1. Open your app under **App registrations**.
2. Go to **Certificates & secrets > New client secret**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FSXyUrPIJNlhLnPTVxnZF%2Fimage.png?alt=media&#x26;token=cfaf8c11-2670-422d-8395-e73669595aa5" alt="New Client Secret"><figcaption><p>Create Client Secret</p></figcaption></figure>

3. Enter a description, select a duration, and click **Add**.
4. Copy the **Client Secret ID** and **Value** — they are shown only once.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FZw1FZwC2hMdtVyYvyHlg%2Fimage.png?alt=media&#x26;token=7f671273-08c9-4ca5-9f1d-77c3c2ffaa69" alt="Secret ID and Value" width="563"><figcaption><p>Client Secret Values</p></figcaption></figure>

5. Go to **IAM** settings and assign roles to your app via **Add role assignment**.

<figure><img src="https://1912836914-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9vAxMuDrkUkB4OXlH9CL%2Fuploads%2FnORRf9aEw2ek6AV0tEbd%2Fimage.png?alt=media&#x26;token=23673868-3275-471e-a8d7-56c526cebd8c" alt="Add IAM Role"><figcaption><p>Role Assignment</p></figcaption></figure>

***

## Generate Access Token <a href="#generate-access-token" id="generate-access-token"></a>

To generate an **Access Token**, follow these steps:

### Step 1: Request Authorization Code

Send a GET request:

````http
GET https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=YOUR_CLIENT_ID
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&response_mode=query
&scope=openid%20offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
&state=12345
&code_challenge=YOUR_CODE_CHALLENGE
&code_challenge_method=S256
# Microsoft Azure Blob Retention Policy

## Overview <a href="#overview" id="overview"></a>

To manage Azure Blob retention policies via WebAPI, you must obtain the following credentials:

1. **Tenant ID**
2. **Client ID**
3. **Client Secret**
4. **Access Token**

These values are required to authenticate and interact with Azure endpoints for retention policy operations.

---

## What Is a Tenant and How to Get a Tenant ID in Azure? <a href="#what-is-tenant-and-how-to-get-a-tenant-id-in-azure" id="what-is-tenant-and-how-to-get-a-tenant-id-in-azure"></a>

A tenant represents your organization in Microsoft cloud services.

To get your **Tenant ID**:
1. Log in to the [Azure portal](https://portal.azure.com/).
2. Go to **Entra ID > Properties**.
3. Copy the value from the **Directory ID** field — this is your Tenant ID.

To create a new tenant:
1. Select **Create a resource**.
2. Search for and select **Entra ID**.
3. Provide a name for your new directory.
4. A **Tenant ID** will be auto-generated.

<figure>
  <img src="../../../../.gitbook/assets/image (121) (1).png" alt="Azure portal - create a new Entra ID tenant">
  <figcaption>Create New Tenant</figcaption>
</figure>

---

## What Is a Client ID and How to Create It? <a href="#what-is-client-id-and-how-to-create-it" id="what-is-client-id-and-how-to-create-it"></a>

A **Client ID** (or Application ID) identifies your app to Azure AD.

To generate it:
1. Go to your Azure directory.
2. Click **App registrations > New registration**.

<figure>
  <img src="../../../../.gitbook/assets/image (125) (1).png" alt="New App Registration" width="563">
  <figcaption>App Registration</figcaption>
</figure>

3. Select the **Single-tenant** option and click **Register**.

<figure>
  <img src="../../../../.gitbook/assets/image (126) (1).png" alt="Single tenant registration" width="544">
  <figcaption>Choose Single-Tenant</figcaption>
</figure>

4. Go to **Authentication**, select app type as **Web**, and configure redirect URI.

<figure>
  <img src="../../../../.gitbook/assets/image (127).png" alt="Authentication tab configuration" width="563">
  <figcaption>Configure Authentication</figcaption>
</figure>

<figure>
  <img src="../../../../.gitbook/assets/image (128).png" alt="Add redirect URI" width="563">
  <figcaption>Web Redirect URI</figcaption>
</figure>

5. The app will now show an **Application ID** — this is your **Client ID**.

<figure>
  <img src="../../../../.gitbook/assets/image (129).png" alt="Application ID shown in portal" width="563">
  <figcaption>Client ID (Application ID)</figcaption>
</figure>

---

## Add a Client Secret <a href="#add-a-client-secret" id="add-a-client-secret"></a>

To create a **Client Secret**:
1. Open your app under **App registrations**.
2. Go to **Certificates & secrets > New client secret**.

<figure>
  <img src="../../../../.gitbook/assets/image (130).png" alt="New Client Secret">
  <figcaption>Create Client Secret</figcaption>
</figure>

3. Enter a description, select a duration, and click **Add**.
4. Copy the **Client Secret ID** and **Value** — they are shown only once.

<figure>
  <img src="../../../../.gitbook/assets/image (131).png" alt="Secret ID and Value" width="563">
  <figcaption>Client Secret Values</figcaption>
</figure>

5. Go to **IAM** settings and assign roles to your app via **Add role assignment**.

<figure>
  <img src="../../../../.gitbook/assets/image (132).png" alt="Add IAM Role">
  <figcaption>Role Assignment</figcaption>
</figure>

---

## Generate Access Token <a href="#generate-access-token" id="generate-access-token"></a>

To generate an **Access Token**, follow these steps:

### Step 1: Request Authorization Code

Send a GET request:

```http
GET https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id=YOUR_CLIENT_ID
&response_type=code
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&response_mode=query
&scope=openid%20offline_access%20https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
&state=12345
&code_challenge=YOUR_CODE_CHALLENGE
&code_challenge_method=S256
````


---

# 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://knowledgebase.autorabit.com/product-guides/vault/configuring-vault/configure-backup-environment/microsoft-azure-blob-retention-policy.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.
