6.8 KiB
id, title, sidebar_position, tags
| id | title | sidebar_position | tags | |||||
|---|---|---|---|---|---|---|---|---|
| using-netbird-with-azure-ad | Using NetBird with Azure AD | 4 |
|
This guide is a part of the NetBird Self-hosting Guide and explains how to integrate self-hosted NetBird with Azure AD.
Azure AD is a an enterprise identity service that provides single sign-on and multifactor authentication to your applications. It is a 3rd party managed service and can't be self-hosted.
:::tip self-hosted idp If you prefer to have full control over authentication and authorization of your NetBird network, there are good self-hosted alternatives to the managed Auth0 service like Keycloak. :::
Before you start creating and configuring an Azure AD application, ensure that you have the following:
-
An Azure account: To create an Azure AD application, you must have an Azure account. If you don't have one, sign up for a free account at https://azure.microsoft.com/free/.
-
User account with appropriate permissions: You must have an Azure AD user account with the appropriate permissions to create and manage Azure AD applications. If you don't have the required permissions, ask your Azure AD administrator to grant them to you.
1. Create and configure Azure AD application
In this step, we will create and configure Netbird application in azure AD.
- Navigate to Azure Active Directory
- Click
App Registrationsin the left menu then click on the+ New registrationbutton to create a new application. - Fill in the form with the following values and click Register
- Name:
Netbird - Account Types:
Accounts in this organizational directory only (Default Directory only - Single tenant) - Redirect URI: select
Single-page application (SPA)and URI ashttps://<yournetbirddomain.com>/silent-auth
- Name:
2. Platform configurations
-
Click
Authenticationon the left side menu -
Under the
Single-page applicationSection, add another URIhttps://<yournetbirddomain.com>/auth
-
Scroll down and setup other options as on the screenshot below and click Save
3. Create a NetBird application scope
- Click
Expose an APIon the left menu - Under
Application ID URIclickSetand thenSave - Click
+ Add a Scope - Fill in the form with the following values and click
Add scope- Scope name:
api
- Scope name:
- Under
Authorized client Applications, click on+ add a client applicationand enter the following: - Fill in the form with the following values and click
Add application- Client ID: same as your Application ID URI minus the
api://
- Client ID: same as your Application ID URI minus the
4. Add API permissions
-
Add
Netbirdpermissions- Click
API permissionson the left menu - Click
Add a permission - Click
My APIstab, and selectNetbird. Next checkapipermission checkbox and clickAdd permissions.
- Click
-
Add
Delagated permissionsto Microsoft Graph- Click
Add a permission - Click
Microsoft Graphand then clickDelagated permissionstab and check all permissions under theOpenId permissionssection and clickAdd permissions
- Click
-
Add
Application permissionsto Microsoft Graph- Click
Add a permission - Click
Microsoft Graphand then clickApplication permissionstab - Search for
User.ReadWrite.Alland underUsersections and checkUser.ReadWrite.Allcheckbox section
- Search for
Application.ReadWrite.Alland underApplicationsections and checkApplication.ReadWrite.Allcheckbox section and clickAdd permissions
- Click
Grant admin conset for Default Directoryand clickYes
- Click
4. Update token version
- Click
Manifeston left menu - Search for
accessTokenAcceptedVersionand change the value fromnullto2 - Click
Save
5. Generate client secret
- Click
Certificates & secretson left menu - Click
New client secret - Fill in the form with the following values and click
Add- Description:
Netbird
- Description:
- Copy
Valueand save it as it can be viewed only once after creation.
Your authority OIDC configuration will be available under:
https://login.microsoftonline.com/<tenant_id>/v2.0/.well-known/openid-configuration
:::caution Double-check if the endpoint returns a JSON response by calling it from your browser. :::
-
Set properties in the
setup.envfile:NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://login.microsoftonline.com/<tenant_id>/v2.0/.well-known/openid-configuration" NETBIRD_USE_AUTH0=false NETBIRD_AUTH_CLIENT_ID="<application_id>" NETBIRD_AUTH_AUDIENCE="<application_id>" NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="<application_id>" NETBIRD_AUTH_REDIRECT_URI="/auth" NETBIRD_AUTH_SILENT_REDIRECT_URI="/silent-auth" NETBIRD_AUTH_USER_ID_CLAIM="oid" -
You can now continue with the NetBird Self-hosting Guide.
-
Set property
IdpManagerConfigin themanagement.jsonfile with: :::caution The file management.json is created automatically. Please refer here for more information. :::{ "ManagerType": "azure", "AzureClientCredentials": { "ClientID": "<application_id>", "ClientSecret": "<client_secret>", "GrantType": "client_credentials", "ObjectID": "<object_id>", "TokenEndpoint": "https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/token", "GraphAPIEndpoint": "https://graph.microsoft.com/v1.0" } } -
Modify the value of the
AUTH_SUPPORTED_SCOPESenvironment variable for the dashboard service in the docker-compose.yml file toopenid profile email offline_access api://<application_id>/api. -
Modify
Scopevalue inDeviceAuthorizationFlowwithin themanagement.jsontoapi://<application_id>/api.









