How to configure authentication with Entra ID¶
Entra ID is an Identity and Access Management offering from Microsoft. It is commonly used as a central location for managing users, groups, roles, and their privileges across many applications and deployments.
LXD supports authentication with Entra ID via OpenID Connect (OIDC) (see OpenID Connect authentication). To set up access, you need to register two Entra ID apps: one for the LXD UI and one for the LXD CLI.
The steps below assume that LXD is initialized and accessible over HTTPS on port 8443 (see How to expose LXD to the network for instructions). It is also assumed that you have access to an Entra ID tenant.
Set up access to the LXD UI¶
Register a new app¶
In your Entra ID tenant, go to Identity > Applications > App registrations in the left panel.
Entra ID App registrations¶
Click + New registration. Then choose a name for the application (for example
LXD UI).Under Redirect URI (optional), select Web, and enter:
https://<your-LXD-hostname>/oidc/callback
Click Register.
Add claims to the ID token¶
In the configuration page for your new application, go to Token configuration in the Manage menu.
Click + Add optional claim and select the
IDtoken type.Select the
emailandxms_edovclaims.Click Add.
Add OpenID permissions¶
Go to API permissions in the Manage menu.
Go to Configured permissions and click + Add a permission.
Entra ID add a permission¶
Select Microsoft Graph in the right panel.
Select Delegated permissions.
Select all OpenID permissions.
Click Add permissions.
Add a client secret¶
Note
Configuration of a client secret for the LXD UI app is optional, but strongly recommended.
In the configuration page for your new application, under Manage, select Certificates & secrets, then select the Client secrets tab.
Click + New client secret.
Add a description and expiration.
Click Add.
Copy the value of the client secret. You will need this in the next step. Once you leave the page, you cannot view the secret again.
Configure LXD¶
In LXD, set
oidc.client.secretto the value of the client secret that you copied above:lxc config set oidc.client.secret <client-secret>
In the Entra ID tenant, go to Overview (above the Manage menu) and copy the Application (client) ID.
Entra ID copy client ID¶
Use this ID to set
oidc.client.idin LXD:lxc config set oidc.client.id <your-client-id>
While still in Overview, click Endpoints and copy the URL under OpenID Connect metadata document.
Entra ID tenant discovery URL¶
Navigate to the URL that you copied. This URL will display some output in JSON format.
Copy the URL from the
issuerfield. Then set this as theoidc.issuerin LXD:lxc config set oidc.issuer <your-issuer>
Alternatively, execute this command:
lxc config set oidc.issuer "$(curl <URL that you copied> | jq -r .issuer)"
Set up access to the LXD CLI¶
Register a new app¶
In your Entra ID tenant, select Identity > Applications > App registrations in the left panel.
Click + New registration. Then enter a name for the application (for example
LXD CLI).Click Register.
Allow public flows¶
In the configuration page for your new application, go to Authentication in the Manage menu.
Entra ID authentication¶
Scroll down to Advanced settings. Under Allow public client flows, toggle Yes and click Save.
Add claims to the access token¶
In the configuration page for the application, go to Token configuration in the Manage menu.
Click + Add optional claim and select the
Accesstoken type.Select the
emailandxms_edovclaims.Click Add.
Specify access token version¶
In the configuration page for the application, go to Manifest in the Manage menu.
Set
api.requestedAccessTokenVersionto2.Click Save.
Add a scope for access to the LXD API¶
In the configuration page for the application, go to Expose an API in the Manage menu.
Click Add next to the Application ID URI.
Use the default App ID URI:
api://<lxd-cli-client-id>.Click Save.
Click Add a scope.
Give the scope a name, such as
lxd.access.Select Admins and users for Who can consent.
Provide a display name and description.
Click Add scope.
Copy the full scope name, which will combine the App ID URI and the scope name:
api://<lxd-cli-client-id>/<scope-name>. You will need it in the next step.
Configure LXD¶
In LXD, set
oidc.scopesto the default scopes (openid,email,offline_access, andprofile), as well as the full Entra ID scope that you copied above:lxc config set oidc.scopes "openid email offline_access profile <full-entra-id-scope>"
Above the Manage menu, go to Overview and copy the Application (client) ID.
Use this ID to set
oidc.audiencein LXD:lxc config set oidc.audience <your-client-id>
Use the same ID to set
oidc.device.client.id:lxc config set oidc.device.client.id <your-client-id>
Log in via Entra ID¶
You can now navigate to the LXD UI in your browser. When you click Login with SSO, you will be redirected to Entra ID to authenticate.
In the terminal, add this LXD server as a remote by running:
lxc remote add <remote-name> <remote-url> --auth-type oidc
This prompts you to accept the public certificate fingerprint of the remote server, which should match the value for certificate shown in lxc info.
If you accept, the CLI then displays a unique login code and opens your browser.
In the browser, log in to your Entra ID tenant and enter the code.
Once the CLI process has completed, you can connect to the remote server.