-
Notifications
You must be signed in to change notification settings - Fork 232
/
azure.identity.ChainedTokenCredential.yml
78 lines (70 loc) · 3.16 KB
/
azure.identity.ChainedTokenCredential.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
### YamlMime:PythonClass
uid: azure.identity.ChainedTokenCredential
name: ChainedTokenCredential
fullName: azure.identity.ChainedTokenCredential
module: azure.identity
inheritances:
- builtins.object
summary: 'A sequence of credentials that is itself a credential.
Its <xref:azure.identity.ChainedTokenCredential.get_token> method calls `get_token`
on each credential in the sequence, in order, returning the first
valid token received.'
constructor:
syntax: 'ChainedTokenCredential(*credentials: TokenCredential)'
parameters:
- name: credentials
description: credential instances to form the chain
isRequired: true
types:
- <xref:azure.core.credentials.TokenCredential>
examples:
- "Create a ChainedTokenCredential.<!--[!code-python[Main](les\\credential_creation_code_snippets.py\
\ )]-->\n\n<!-- literal_block {\"ids\": [], \"classes\": [], \"names\": [], \"dupnames\"\
: [], \"backrefs\": [], \"source\": \"C:\\\\hostedtoolcache\\\\windows\\\\Python\\\
\\3.11.9\\\\x64\\\\Lib\\\\site-packages\\\\py2docfx\\\\dist_temp\\\\46\\\\azure-identity-1.16.0\\\
\\samples\\\\credential_creation_code_snippets.py\", \"xml:space\": \"preserve\"\
, \"force\": false, \"language\": \"python\", \"highlight_args\": {\"linenostart\"\
: 1}, \"linenos\": false} -->\n\n````python\n\n from azure.identity import ChainedTokenCredential,\
\ EnvironmentCredential, AzureCliCredential\n\n credential_chain = (\n #\
\ Try EnvironmentCredential first\n EnvironmentCredential(),\n # Fallback\
\ to Azure CLI if EnvironmentCredential fails\n AzureCliCredential(),\n \
\ )\n credential = ChainedTokenCredential(*credential_chain)\n\n ````\n"
methods:
- uid: azure.identity.ChainedTokenCredential.close
name: close
summary: Close the transport session of each credential in the chain.
signature: close() -> None
- uid: azure.identity.ChainedTokenCredential.get_token
name: get_token
summary: 'Request a token from each chained credential, in order, returning the
first token received.
This method is called automatically by Azure SDK clients.'
signature: 'get_token(*scopes: str, claims: str | None = None, tenant_id: str |
None = None, **kwargs: Any) -> AccessToken'
parameters:
- name: scopes
description: 'desired scopes for the access token. This method requires at least
one scope.
For more information about scopes, see
[https://learn.microsoft.com/entra/identity-platform/scopes-oidc](https://learn.microsoft.com/entra/identity-platform/scopes-oidc).'
isRequired: true
types:
- <xref:str>
keywordOnlyParameters:
- name: claims
description: 'additional claims required in the token, such as those returned
in a resource provider''s
claims challenge following an authorization failure.'
types:
- <xref:str>
- name: tenant_id
description: optional tenant to include in the token request.
types:
- <xref:str>
return:
description: An access token with the desired scopes.
types:
- <xref:azure.core.credentials.AccessToken>
exceptions:
- type: azure.core.exceptions.ClientAuthenticationError
description: no credential in the chain provided a token