Skip to content

Commit 87ed2b7

Browse files
author
Yalin Li
authored
[AppConfig] Add troubleshooting guide (Azure#29657)
1 parent 92301d2 commit 87ed2b7

File tree

2 files changed

+66
-12
lines changed

2 files changed

+66
-12
lines changed

sdk/appconfiguration/azure-appconfiguration/README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,18 +287,7 @@ async for item in config_settings:
287287

288288
## Troubleshooting
289289

290-
### Logging
291-
292-
This SDK uses Python standard logging library.
293-
You can configure logging print out debugging information to the stdout or anywhere you want.
294-
295-
```python
296-
import logging
297-
298-
logging.basicConfig(level=logging.DEBUG)
299-
````
300-
301-
Http request and response details are printed to stdout with this logging config.
290+
See the [troubleshooting guide][troubleshooting_guide] for details on how to diagnose various failure scenarios.
302291

303292
## Next steps
304293

@@ -344,3 +333,4 @@ additional questions or comments.
344333
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
345334
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
346335
[coc_contact]: mailto:[email protected]
336+
[troubleshooting_guide]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Troubleshoot Azure App Configuration client library issues
2+
3+
This troubleshooting guide contains instructions to diagnose frequently encountered issues while using the Azure App Configuration client library for Python.
4+
5+
## Table of contents
6+
7+
* [General troubleshooting](#general-troubleshooting)
8+
* [Enable client logging](#enable-client-logging)
9+
* [Troubleshooting authentication issues](#troubleshooting-authentication-issues)
10+
* [ClientAuthenticationError](#clientauthenticationerror)
11+
* [CredentialUnavailableError](#credentialunavailableerror)
12+
* [Permission issues](#permission-issues)
13+
* [Get additional help](#get-additional-help)
14+
15+
## General Troubleshooting
16+
17+
Azure App Configuration client library will raise exceptions defined in [Azure Core](https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions).
18+
19+
### Enable client logging
20+
21+
This library uses the standard [logging](https://docs.python.org/3/library/logging.html) library for logging.
22+
23+
Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.
24+
25+
Detailed `DEBUG` level logging, including request/response bodies and **unredacted** headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.
26+
27+
See full Python SDK logging documentation with examples [here](https://docs.microsoft.com/azure/developer/python/azure-sdk-logging).
28+
29+
## Troubleshooting authentication issues
30+
31+
In addition to connection strings, Azure App Configuration supports [role-based access control](https://learn.microsoft.com/azure/role-based-access-control/overview) (RBAC) using Azure Active Directory authentication. For more details on getting started, see the [README](https://learn.microsoft.com/python/api/overview/azure/appconfiguration-readme?view=azure-python) of Azure App Configuration library. For details on the credential types supported in `azure.identity`, see the [Azure Identity documentation](https://learn.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python).
32+
33+
If authentication or authorization fails, you will likely encounter one of these errors:
34+
35+
### ClientAuthenticationError
36+
37+
Errors arising from authentication can be raised on any service client method that makes a request to the service. This is because the token is requested from the credential on the first call to the service and on any subsequent requests to the service that need to refresh the token.
38+
39+
To distinguish these failures from failures in the service client, Azure Identity raises the `ClientAuthenticationError` with details describing the source of the error in the error message. Depending on the application, these errors may or may not be recoverable.
40+
41+
```python
42+
from azure.core.exceptions import ClientAuthenticationError
43+
from azure.identity import DefaultAzureCredential
44+
from azure.appconfiguration import AzureAppConfigurationClient
45+
46+
# Create a secret client using the DefaultAzureCredential
47+
client = AzureAppConfigurationClient("<my_endpoint_string>", DefaultAzureCredential())
48+
try:
49+
client.get_configuration_setting("key")
50+
except ClientAuthenticationError as ex:
51+
print(f"Authentication failed. {ex.message}")
52+
```
53+
54+
### CredentialUnavailableError
55+
56+
The `CredentialUnavailableError` is a specific error type derived from `ClientAuthenticationError`. This error type is used to indicate that the credential can't authenticate in the current environment, due to missing required configuration or setup. This error is also used as an indication for chained credential types, such as `DefaultAzureCredential` and `ChainedTokenCredential`, that the chained credential should continue to attempt other credential types later in the chain.
57+
58+
### Permission issues
59+
60+
Service client calls that result in `HttpResponseError` with a `StatusCode` of 401 or 403 often indicate the caller doesn't have sufficient permissions for the specified API. Check the service documentation to determine which RBAC roles are needed for the specific request, and ensure the authenticated user or service principal have been granted the appropriate roles on the resource.
61+
62+
## Get additional help
63+
64+
Additional information on ways to reach out for support can be found in the [SUPPORT.md](https://github.com/Azure/azure-sdk-for-python/blob/main/SUPPORT.md) at the root of the repo.

0 commit comments

Comments
 (0)