Skip to content

Commit 9cf809d

Browse files
xiangyan99Scott Schaab
andauthored
update docs (#26301)
* update docs * update * Update sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py Co-authored-by: Scott Schaab <[email protected]> * Update sdk/identity/azure-identity/azure/identity/_credentials/client_secret.py Co-authored-by: Scott Schaab <[email protected]> * Update sdk/identity/azure-identity/azure/identity/_credentials/certificate.py Co-authored-by: Scott Schaab <[email protected]> * updates * updates Co-authored-by: Scott Schaab <[email protected]>
1 parent 448d6b3 commit 9cf809d

20 files changed

+76
-53
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Breaking Changes
2+
3+
## 1.11.0
4+
5+
### Behavioral change to credential types supporting multi-tenant authentication
6+
7+
As of `azure-identity` 1.11.0, the default behavior of credentials supporting multi-tenant authentication has changed. Each of these credentials will throw an `ClientAuthenticationError` if the requested `tenant_id` doesn't match the tenant ID originally configured on the credential. Apps must now do one of the following things:
8+
9+
- Add all IDs, of tenants from which tokens should be acquired, to the `additionally_allowed_tenants` list in the credential options. For example:
10+
11+
```py
12+
credential = DefaultAzureCredential(additionally_allowed_tenants = ["<tenant_id_1>", "<tenant_id_2>"])
13+
```
14+
15+
- Add `*` to enable token acquisition from any tenant. This is the original behavior and is compatible with previous versions supporting multi tenant authentication. For example:
16+
17+
```py
18+
credential = DefaultAzureCredential(additionally_allowed_tenants=['*'])
19+
```
20+
21+
Note: Credential types which do not require a `tenant_id` on construction will only throw `ClientAuthenticationError` when the application has provided a value for `tenant_id` in the constructor. If no `tenant_id` is specified when constructing the credential, the credential will acquire tokens for any requested `tenant_id` regardless of the value of `additionally_allowed_tenants`.
22+
23+
More information on this change and the consideration behind it can be found [here](https://aka.ms/azsdk/blog/multi-tenant-guidance).

sdk/identity/azure-identity/CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Release History
22

3-
## 1.11.0 (2022-09-20)
3+
## 1.11.0 (2022-09-19)
44

55
### Features Added
66

@@ -16,6 +16,18 @@
1616
- `UsernamePasswordCredential`
1717
- `VisualStudioCodeCredential`
1818

19+
### Breaking Changes
20+
21+
- Credential types supporting multi-tenant authentication will now throw `ClientAuthenticationError` if the requested tenant ID doesn't match the credential's tenant ID, and is not included in `additionally_allowed_tenants`. Applications must now explicitly add additional tenants to the `additionally_allowed_tenants` list, or add '*' to list, to enable acquiring tokens from tenants other than the originally specified tenant ID.
22+
23+
More information on this change and the consideration behind it can be found [here](https://aka.ms/azsdk/blog/multi-tenant-guidance).
24+
25+
- These beta features in 1.11.0b3 have been removed from this release and will be added back in 1.12.0b1
26+
- `tenant_id` for `AzureCliCredential`
27+
- removed `VisualStudioCodeCredential` from `DefaultAzureCredential` token chain
28+
- `AZURE_CLIENT_CERTIFICATE_PASSWORD` support for `EnvironmentCredential`
29+
- `validate_authority` support
30+
1931
## 1.11.0b3 (2022-08-09)
2032

2133
Azure-identity is supported on Python 3.7 or later. For more details, please read our page on [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy).

sdk/identity/azure-identity/azure/identity/_credentials/authorization_code.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class AuthorizationCodeCredential(GetTokenMixin):
3030
the authority for Azure Public Cloud (which is the default). :class:`~azure.identity.AzureAuthorityHosts`
3131
defines authorities for other clouds.
3232
:keyword str client_secret: One of the application's client secrets. Required only for web apps and web APIs.
33-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
34-
may acquire tokens. Add the wildcard value "*" to allow the credential to attempt to acquire tokens
35-
for any tenant.
33+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
34+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
35+
acquire tokens for any tenant the application can access.
3636
"""
3737

3838
def __init__(self, tenant_id, client_id, authorization_code, redirect_uri, **kwargs):

sdk/identity/azure-identity/azure/identity/_credentials/azure_cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ class AzureCliCredential(object):
3636
3737
This requires previously logging in to Azure via "az login", and will use the CLI's currently logged in identity.
3838
39-
:keyword List[str] additionally_allowed_tenants: optional additional tenant ids for which the credential
40-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
41-
any tenant the application is installed.
4239
"""
4340
def __init__(self, *, additionally_allowed_tenants: List[str] = None):
4441

sdk/identity/azure-identity/azure/identity/_credentials/azure_powershell.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ class AzurePowerShellCredential(object):
5252
5353
This requires previously logging in to Azure via "Connect-AzAccount", and will use the currently logged in identity.
5454
55-
:keyword List[str] additionally_allowed_tenants: optional additional tenant ids for which the credential
56-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
57-
any tenant the application is installed.
5855
"""
5956
def __init__(self, *, additionally_allowed_tenants: List[str] = None):
6057

sdk/identity/azure-identity/azure/identity/_credentials/certificate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class CertificateCredential(ClientCredentialBase):
4545
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
4646
will cache tokens in memory.
4747
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
48-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
49-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
50-
any tenant the application is installed.
48+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
49+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
50+
acquire tokens for any tenant the application can access.
5151
"""
5252

5353
def __init__(self, tenant_id, client_id, certificate_path=None, **kwargs):

sdk/identity/azure-identity/azure/identity/_credentials/client_assertion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def __init__(self, tenant_id, client_id, func, **kwargs):
2929
:keyword str authority: Authority of an Azure Active Directory endpoint, for example
3030
"login.microsoftonline.com", the authority for Azure Public Cloud (which is the default).
3131
:class:`~azure.identity.AzureAuthorityHosts` defines authorities for other clouds.
32-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
33-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
34-
any tenant the application is installed.
32+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
33+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
34+
acquire tokens for any tenant the application can access.
3535
"""
3636
self._func = func
3737
self._client = AadClient(tenant_id, client_id, **kwargs)

sdk/identity/azure-identity/azure/identity/_credentials/client_secret.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class ClientSecretCredential(ClientCredentialBase):
2424
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
2525
will cache tokens in memory.
2626
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
27-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
28-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
29-
any tenant the application is installed.
27+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
28+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
29+
acquire tokens for any tenant the application can access.
3030
"""
3131

3232
def __init__(self, tenant_id, client_id, client_secret, **kwargs):

sdk/identity/azure-identity/azure/identity/_credentials/on_behalf_of.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ class OnBehalfOfCredential(MsalCredential, GetTokenMixin):
4848
is a unicode string, it will be encoded as UTF-8. If the certificate requires a different encoding, pass
4949
appropriately encoded bytes instead.
5050
:paramtype password: str or bytes
51-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
52-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
53-
any tenant the application is installed.
51+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
52+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
53+
acquire tokens for any tenant the application can access.
5454
"""
5555

5656
def __init__(self, tenant_id, client_id, **kwargs):

sdk/identity/azure-identity/azure/identity/_credentials/user_password.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class UsernamePasswordCredential(InteractiveCredential):
3737
:keyword cache_persistence_options: Configuration for persistent token caching. If unspecified, the credential
3838
will cache tokens in memory.
3939
:paramtype cache_persistence_options: ~azure.identity.TokenCachePersistenceOptions
40-
:keyword List[str] additionally_allowed_tenants: Optional additional tenant ids for which the credential
41-
may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for
42-
any tenant the application is installed.
40+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
41+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
42+
acquire tokens for any tenant the application can access.
4343
"""
4444

4545
def __init__(self, client_id, username, password, **kwargs):

0 commit comments

Comments
 (0)