# Azure SQL Server Configuration Prerequisites

Before the Azure SQL Server Provider can be configured and used for Azure Active Directory (AAD) methods, there are certain prerequisites that must be followed.

### Azure Active Directory User

1. Create a new user or use an existing user in Azure Active Directory.

{% hint style="info" %}
**Note:** Note down the *Principal Name* and *password* as it will be used later.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/y4ApIrCCa1hlCgsdCvDx/01-Priniple.PNG)

### Creating a Service Principal

1. Create a service principal from the Azure Portal by navigating to Azure Active Directory and selecting *App Registrations*. Then, select *New Registration.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/Dz2M2zLGQL4XWYRW4SZN/02-App-Regis.PNG)

2. Provide the name of the new application and select *Accounts in this organizational directory only*

{% hint style="info" %}
**Note:** For *Redirect URI*, select *Public client/native (mobile & desktop)* or *Web* and provide [*http://localhost:8050/*](http://localhost:8050/).
{% endhint %}

Click *Register*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/jZcNtUya56fpd1qHNfMU/03-Register.PNG)

3. Write down the *Application (client) ID* for later use.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/VDwMBoMAj4N4Yk7rPiwy/04-Name.PNG)

4. Add new permissions for Azure SQL Database by navigating to the *API permissions* and clicking *Add a permission*.

Select *APIs my organization uses* and search for *Azure SQL Database.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/z2wY048f4yLY1lFqL82W/05-Permissions-App.png)

5. Select *Delegated permissions* and check *user\_impersonation*.

Click on *Add permission.*

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/izKTa7yPPhTMufqScumM/06-Add-Permission.PNG)

### Provisioning Azure AD Admin for Azure SQL Server

1. Create an SQL Server by navigating to the SQL Server at Azure Portal.

{% hint style="info" %}
**Note:** Write down the Server name.
{% endhint %}

![07-Add](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/brBoPK2MpUCWmQmPtV5E/07-Add.PNG)

2. Set an admin by navigating to Azure Active Directory in settings.

Click *Set Admin* and search for the user (existing or new) in Azure Active Directory. Then Click *Select.*

![08-Set-Admin](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/ewN5QiIZaw3xQBDOtd43/08-Set-Admin.PNG)

All the above-mentioned steps will be used in configuring the Azure SQL Server connecter for Azure Active Directory (AAD) methods.
