Skip to content

Commit b6fa860

Browse files
authored
Clarify lookups of Microsoft IdP attributes (#47597)
Closes #19118 Edit the Role Reference, Azure AD, and AD FS guides to explain that you must use bracket notation to look up Azure AD and AD FS attributes in roles.
1 parent 157e73f commit b6fa860

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

docs/pages/admin-guides/access-controls/sso/adfs.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ The login
130130
<nobr>`{{external["http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]}}`</nobr>
131131
configures Teleport to look at the
132132
`http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname`
133-
ADFS claim and use that field as an allowed login for each user. Note the
134-
double quotes (`"`) and square brackets (`[]`) around the claim name—these are
135-
important.
133+
attribute and use that field as an allowed login for each user. Since the name
134+
of the attribute contains characters besides letters, numbers, and underscores,
135+
you must use double quotes (`"`) and square brackets (`[]`) around the name of
136+
the attribute.
136137

137138
## Step 3/3. Create a SAML connector
138139

docs/pages/admin-guides/access-controls/sso/azuread.mdx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,7 @@ $ tctl create -f azure-connector.yaml
173173
Create a Teleport role resource that will use external username data from the
174174
Azure AD connector to determine which Linux logins to allow on a host.
175175

176-
Users with the following `dev` role are only allowed to log in to nodes with
177-
the `access: relaxed` Teleport label. They can log in as either `ubuntu` or a
178-
username that is passed in from the Azure AD connector. Users with this role can't
179-
obtain admin access to Teleport.
176+
Create a file called `dev.yaml` with the following content:
180177

181178
```yaml
182179
kind: role
@@ -187,12 +184,27 @@ spec:
187184
options:
188185
max_session_ttl: 24h
189186
allow:
190-
logins: [ "{{external.username}}", ubuntu ]
187+
# only allow login as either ubuntu or the 'windowsaccountname' claim
188+
logins: [ '{{external["http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]}}', ubuntu ]
191189
node_labels:
192190
access: relaxed
193191
```
194192

195-
Replace `ubuntu` with the Linux login available on your servers.
193+
Users with the `dev` role are only allowed to log in to nodes with the `access:
194+
relaxed` Teleport label. They can log in as either `ubuntu` or a username that
195+
is passed in from the Azure AD connector using the `windowsaccountname`
196+
attribute.
197+
198+
The login
199+
<nobr>`{{external["http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]}}`</nobr>
200+
configures Teleport to look at the
201+
`http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname`
202+
attribute and use that field as an allowed login for each user. Since the name
203+
of the attribute contains characters besides letters, numbers, and underscores,
204+
you must use double quotes (`"`) and square brackets (`[]`) around the name of
205+
the attribute.
206+
207+
Create the role:
196208

197209
```code
198210
$ tctl create dev.yaml

docs/pages/reference/access-controls/roles.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ logins:
558558
- '{{external["http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]}}'
559559
```
560560

561-
562561
In role templates, you can refer to these variables using the following two
563562
formats, where `trait` is the name of the trait:
564563

@@ -570,7 +569,14 @@ attribute or OIDC claim called `trait`.
570569

571570
You can specify an external trait in dot syntax if it begins with a letter and
572571
contains only letters, numbers, and underscores. Otherwise, you must use bracket
573-
syntax to specify a trait.
572+
syntax to specify a trait.
573+
574+
When using Azure AD or ADFS as your IdP, you must use bracket notation, as these
575+
IdPs assign attribute keys to URLs such as the following:
576+
577+
```text
578+
http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname
579+
```
574580

575581
Common examples of external traits available through an identity provider
576582
include the following:

0 commit comments

Comments
 (0)