Skip to content

Commit 8f9e770

Browse files
authored
[Identity] Doc formatting fixes (Azure#26664)
- Fixed a few issues with docs not being rendered as expected on the api docs website. - Added a note in the DAC troubleshooting section for users who are directed there from an error regarding additionally_allowed_tenants configuration. Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
1 parent dd6c0d8 commit 8f9e770

File tree

4 files changed

+41
-37
lines changed

4 files changed

+41
-37
lines changed

sdk/identity/azure-identity/TROUBLESHOOTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ See full SDK logging documentation with examples [here][sdk_logging_docs].
8282
| Error |Description| Mitigation |
8383
|---|---|---|
8484
|`CredentialUnavailableError` raised with message. "DefaultAzureCredential failed to retrieve a token from the included credentials."|All credentials in the `DefaultAzureCredential` chain failed to retrieve a token, each raising a `CredentialUnavailableError` themselves|<ul><li>[Enable logging](#logging) to verify the credentials being tried, and get further diagnostic information.</li><li>Consult the troubleshooting guide for underlying credential types for more information.</li><ul><li>[EnvironmentCredential](#troubleshoot-environmentcredential-authentication-issues)</li><li>[ManagedIdentityCredential](#troubleshoot-managedidentitycredential-authentication-issues)</li><li>[VisualStudioCodeCredential](#troubleshoot-visualstudiocodecredential-authentication-issues)</li><li>[AzureCLICredential](#troubleshoot-azureclicredential-authentication-issues)</li><li>[AzurePowershellCredential](#troubleshoot-azurepowershellcredential-authentication-issues)</li></ul>|
85-
|`ClientAuthenticationError` raised from the client with a status code of 401 or 403|Authentication succeeded but the authorizing Azure service responded with a 401 (Authenticate), or 403 (Forbidden) status code. This can often be caused by the `DefaultAzureCredential` authenticating an account other than the intended one.|<ul><li>[Enable logging](#logging) to determine which credential in the chain returned the authenticating token.</li><li>In the case a credential other than the expected is returning a token, bypass this by either signing out of the corresponding development tool, or excluding the credential with an `exclude_xxx_credential` keyword argument when creating `DefaultAzureCredential`</li></ul>|
85+
|`ClientAuthenticationError` raised from the client with a status code of 401 or 403|Authentication succeeded but the authorizing Azure service responded with a 401 (Authenticate), or 403 (Forbidden) status code. This can often be caused by the `DefaultAzureCredential` authenticating an account other than the intended one.|<ul><li>[Enable logging](#logging) to determine which credential in the chain returned the authenticating token.</li><li>In the case a credential other than the expected is returning a token, bypass this by either signing out of the corresponding development tool, or excluding the credential with an `exclude_xxx_credential` keyword argument when creating `DefaultAzureCredential`.</li><li>Consult the [troubleshooting guide](#troubleshoot-multi-tenant-authentication-issues) for multi-tenant authentication issues if an error is encountered stating the current credential is not configured to acquire tokens for a tenant.</li></ul>|
8686

8787
## Troubleshoot `EnvironmentCredential` authentication issues
8888

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@
1313

1414

1515
class ClientAssertionCredential(GetTokenMixin):
16+
"""Authenticates a service principal with a JWT assertion.
17+
18+
This credential is for advanced scenarios. :class:`~azure.identity.ClientCertificateCredential` has a more
19+
convenient API for the most common assertion scenario, authenticating a service principal with a certificate.
20+
21+
:param str tenant_id: ID of the principal's tenant. Also called its "directory" ID.
22+
:param str client_id: The principal's client ID
23+
:param func: A callable that returns a string assertion. The credential will call this every time it
24+
acquires a new token.
25+
:paramtype func: Callable[[], str]
26+
27+
:keyword str authority: Authority of an Azure Active Directory endpoint, for example
28+
"login.microsoftonline.com", the authority for Azure Public Cloud (which is the default).
29+
:class:`~azure.identity.AzureAuthorityHosts` defines authorities for other clouds.
30+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
31+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
32+
acquire tokens for any tenant the application can access.
33+
"""
34+
1635
def __init__(self, tenant_id, client_id, func, **kwargs):
1736
# type: (str, str, Callable[[], str], **Any) -> None
18-
"""Authenticates a service principal with a JWT assertion.
19-
20-
This credential is for advanced scenarios. :class:`~azure.identity.ClientCertificateCredential` has a more
21-
convenient API for the most common assertion scenario, authenticating a service principal with a certificate.
22-
23-
:param str tenant_id: ID of the principal's tenant. Also called its "directory" ID.
24-
:param str client_id: The principal's client ID
25-
:param func: A callable that returns a string assertion. The credential will call this every time it
26-
acquires a new token.
27-
:paramtype func: Callable[[], str]
28-
29-
:keyword str authority: Authority of an Azure Active Directory endpoint, for example
30-
"login.microsoftonline.com", the authority for Azure Public Cloud (which is the default).
31-
:class:`~azure.identity.AzureAuthorityHosts` defines authorities for other clouds.
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.
35-
"""
3637
self._func = func
3738
self._client = AadClient(tenant_id, client_id, **kwargs)
3839
super(ClientAssertionCredential, self).__init__(**kwargs)

sdk/identity/azure-identity/azure/identity/_persistent_cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class TokenCachePersistenceOptions(object):
3131
.. warning:: The cache contains authentication secrets. If the cache is not encrypted, protecting it is the
3232
application's responsibility. A breach of its contents will fully compromise accounts.
3333
34+
.. admonition:: Example:
35+
3436
.. literalinclude:: ../tests/test_persistent_cache.py
3537
:start-after: [START snippet]
3638
:end-before: [END snippet]

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,26 @@
1313

1414

1515
class ClientAssertionCredential(AsyncContextManager, GetTokenMixin):
16+
"""Authenticates a service principal with a JWT assertion.
17+
18+
This credential is for advanced scenarios. :class:`~azure.identity.ClientCertificateCredential` has a more
19+
convenient API for the most common assertion scenario, authenticating a service principal with a certificate.
20+
21+
:param str tenant_id: ID of the principal's tenant. Also called its "directory" ID.
22+
:param str client_id: The principal's client ID
23+
:param func: A callable that returns a string assertion. The credential will call this every time it
24+
acquires a new token.
25+
:paramtype func: Callable[[], str]
26+
27+
:keyword str authority: Authority of an Azure Active Directory endpoint, for example
28+
"login.microsoftonline.com", the authority for Azure Public Cloud (which is the default).
29+
:class:`~azure.identity.AzureAuthorityHosts` defines authorities for other clouds.
30+
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
31+
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
32+
acquire tokens for any tenant the application can access.
33+
"""
34+
1635
def __init__(self, tenant_id: str, client_id: str, func: "Callable[[], str]", **kwargs: "Any") -> None:
17-
"""Authenticates a service principal with a JWT assertion.
18-
19-
This credential is for advanced scenarios. :class:`~azure.identity.ClientCertificateCredential` has a more
20-
convenient API for the most common assertion scenario, authenticating a service principal with a certificate.
21-
22-
:param str tenant_id: ID of the principal's tenant. Also called its "directory" ID.
23-
:param str client_id: The principal's client ID
24-
:param func: A callable that returns a string assertion. The credential will call this every time it
25-
acquires a new token.
26-
:paramtype func: Callable[[], str]
27-
28-
:keyword str authority: Authority of an Azure Active Directory endpoint, for example
29-
"login.microsoftonline.com", the authority for Azure Public Cloud (which is the default).
30-
:class:`~azure.identity.AzureAuthorityHosts` defines authorities for other clouds.
31-
:keyword List[str] additionally_allowed_tenants: Specifies tenants in addition to the specified "tenant_id"
32-
for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to
33-
acquire tokens for any tenant the application can access.
34-
"""
3536
self._func = func
3637
self._client = AadClient(tenant_id, client_id, **kwargs)
3738
super().__init__(**kwargs)

0 commit comments

Comments
 (0)