> For the complete documentation index, see [llms.txt](https://docs.appmachine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmachine.com/app-details/user-management/setup-azure-active-directory.md).

# Setup Azure Active Directory

In this article you'll read how to setup user authentication via Azure Active Directory. Configuring this correctly consists of the following steps:

* [Registering an application within the Azure Portal.](#registering-an-application-within-the-azure-portal)
* [Obtaining the Client ID and Tenant ID.](#obtaining-the-client-id-and-tenant-id)
* [Creating a Client Secret within the Azure app.](#creating-a-client-secret-within-the-azure-app)
* [Enabling Azure Active Directory authentication in AppMachine.](#enabling-azure-active-directory-authentication-in-appmachine)

### Registering an application within the Azure Portal

1. **Navigate** to the [registered apps page of the Azure Portal](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps) and login.
2. **Click +New registration** to create a new app.<br>

   <figure><img src="/files/luUnyMBvJxUZTmXjPOex" alt=""><figcaption><p>Azure Portal - App registrations</p></figcaption></figure>
3. **Enter the name** of your app.
4. **Select** the **Single tenant** option as the supported account type.
5. **Set the Redirect URI** to type **Web** and enter the following **value**: \
   &#x20;`https://app-services.cmsappbuilder.com/api/application-users/v1/social/callback/microsoft`
6. **Click Register** to create the Azure application.<br>

   <figure><img src="/files/DmhKKxZL7eO5NDtKV6xK" alt=""><figcaption><p>Azure Portal - Register application </p></figcaption></figure>

### Obtaining the Client ID and Tenant ID

7. **Open** the **Overview page** of your Azure application.
8. **Copy** the **Application (client) ID** and the **Directory (tenant) ID**. These values will be required during the setup in AppMachine.\
   &#x20;

   <figure><img src="/files/USaXBk3hD5ObUCQEiEFc" alt=""><figcaption><p>Azure Portal - App overview</p></figcaption></figure>

### Creating a Client Secret within the Azure app

9. **Open** the **Certificates & secrets** page.

10. **Click +New client secret**.<br>

    <figure><img src="/files/5KVnZin4uEFsRVd2gMM0" alt=""><figcaption><p>Azure Portal - Certificates &#x26; secrets</p></figcaption></figure>

11. **Enter** a **description** and **set** the client secret's **expiration** time.\
    \
    \&#xNAN;***Note:** AppMachine is not able to track the client secret expiration date. When the client secret expires users will no longer be able to login to the app. To prevent this from happening, the client secret will have to be renewed and updated in AppMachine before the secret expires.* <br>

    <figure><img src="/files/eKKAX0eIND6GKsceLlz3" alt=""><figcaption><p>Azure Portal - Add a client secret</p></figcaption></figure>

12. **Click** the **Add** button to create the client secret.

13. **Copy** the **value** of the client secret displayed on the screen. This value will be required during the setup in AppMachine.\
    \
    \&#xNAN;***Note:** The Client Secret value can only be viewed once, directly after creating it.*

### Enabling Azure Active Directory authentication in AppMachine

14. **Open** the [**Login Settings**](https://app-home.appmachine.com/user-access/authentication) page of your AppMachine app and **enable User login**.

15. **Enable** the options **Azure Active Directory** and **Users can register a new account for this app**.<br>

    <figure><img src="/files/V07YxLh3UWXzYgkai2en" alt=""><figcaption><p>AppMachine - Login Settings</p></figcaption></figure>

16. **Click Configure** and **enter the Client ID, Tenant ID, and Client Secret** obtained via the steps above, and click Save to complete the setup.<br>

    <figure><img src="/files/jdorD4X2SKgShh1PkhFe" alt=""><figcaption><p>AppMachine - Configure Azure Active Directory</p></figcaption></figure>

17. Finally, **Save your changes on the Login Settings page** to complete the setup.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.appmachine.com/app-details/user-management/setup-azure-active-directory.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
