|
| 1 | +# Troubleshoot Azure Container Registry client library issues |
| 2 | + |
| 3 | +This troubleshooting guide contains instructions to diagnose frequently encountered issues while using the Azure Container Registry client library for Python. |
| 4 | + |
| 5 | +## General Troubleshooting |
| 6 | + |
| 7 | +ACR client library will raise exceptions defined in [Azure Core][azure_core_exceptions]. |
| 8 | + |
| 9 | +### Enable client logging |
| 10 | + |
| 11 | +This library uses the standard |
| 12 | +[logging][python_logging] library for logging. |
| 13 | + |
| 14 | +Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level. |
| 15 | + |
| 16 | +Detailed `DEBUG` level logging, including request/response bodies and **unredacted** |
| 17 | +headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument. |
| 18 | + |
| 19 | +See full Python SDK logging documentation with examples [here][sdk_logging_docs]. |
| 20 | + |
| 21 | +### Optional Configuration |
| 22 | + |
| 23 | +Optional keyword arguments can be passed in at the client and per-operation level. |
| 24 | +The azure-core [reference documentation][azure_core_ref_docs] |
| 25 | +describes available configurations for retries, logging, transport protocols, and more. |
| 26 | + |
| 27 | +## Troubleshooting authentication errors |
| 28 | + |
| 29 | +### HTTP 401 Errors |
| 30 | + |
| 31 | +HTTP 401 errors indicate problems authenticating. Check the exception message or logs for more information. |
| 32 | + |
| 33 | +#### Anonymous access issues |
| 34 | + |
| 35 | +You may see error similar to the one below, it indicates an attempt to perform operation that requires authentication without credentials. |
| 36 | + |
| 37 | +``` |
| 38 | +{"errors":[{"code":"UNAUTHORIZED","message":"authentication required, visit https://aka.ms/acr/authorization for |
| 39 | +more information."}]} |
| 40 | +``` |
| 41 | + |
| 42 | +Unauthorized access can only be enabled for read (pull) operations such as listing repositories, getting properties or tags. Refer to [Anonymous pull access] to learn about anonymous access limitation. |
| 43 | + |
| 44 | +### HTTP 403 Errors |
| 45 | + |
| 46 | +HTTP 403 errors indicate that user is not authorized to perform a specific operation in Azure Container Registry. |
| 47 | + |
| 48 | +#### Insufficient permissions |
| 49 | + |
| 50 | +If you see an error similar to the one below, it means that the provided credentials do not have permission to access the registry. |
| 51 | + |
| 52 | +``` |
| 53 | +{"errors":[{"code":"DENIED","message":"retrieving permissions failed"}]} |
| 54 | +``` |
| 55 | + |
| 56 | +To resolve: |
| 57 | + |
| 58 | +1. Check that the application or user that is making the request has sufficient permissions. Check [Troubleshoot registry login] for possible solutions. |
| 59 | +1. If the user or application is granted sufficient privileges to query the workspace, make sure you are authenticating as that user/application. If you are authenticating using [DefaultAzureCredential], check the logs to verify that the credential used is the one you expected. To enable logging, see the [Enable client logging] section above. |
| 60 | + |
| 61 | +For more help on troubleshooting authentication errors, please see the Azure Identity client library [troubleshooting guide]. |
| 62 | + |
| 63 | +#### Network access issues |
| 64 | + |
| 65 | +The below error indicates that public access to the Azure Container Registry is disabled or restricted. Refer to [Troubleshoot network issues with registry] for more information. |
| 66 | + |
| 67 | +``` |
| 68 | +{"errors":[{"code":"DENIED","message":"client with IP '<your IP address>' is not allowed access. Refer https://aka.m |
| 69 | +s/acr/firewall to grant access."}]} |
| 70 | +``` |
| 71 | + |
| 72 | +<!-- LINKS --> |
| 73 | +[azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions |
| 74 | +[python_logging]: https://docs.python.org/3/library/logging.html |
| 75 | +[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging |
| 76 | +[azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs |
| 77 | +[anonymous pull access]: https://docs.microsoft.com/azure/container-registry/anonymous-pull-access |
| 78 | +[troubleshoot registry login]: https://docs.microsoft.com/azure/container-registry/container-registry-troubleshoot-login |
| 79 | +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md#authenticate-with-defaultazurecredential |
| 80 | +[enable client logging]: https://github.com/Azure/azure-sdk-for-python/blob/6f443271cb603025e1351f3356eb2606d79e00ec/sdk/containerregistry/azure-containerregistry/TROUBLESHOOTING.md#enable-client-logging |
| 81 | +[troubleshooting guide]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/TROUBLESHOOTING.md |
| 82 | +[troubleshoot network issues with registry]: https://docs.microsoft.com/azure/container-registry/container-registry-troubleshoot-access |
0 commit comments