diff --git a/sdk/attestation/azure-mgmt-attestation/README.md b/sdk/attestation/azure-mgmt-attestation/README.md index cd97834e9691..9871732f1f7d 100644 --- a/sdk/attestation/azure-mgmt-attestation/README.md +++ b/sdk/attestation/azure-mgmt-attestation/README.md @@ -8,9 +8,21 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting Started +### Prerequsites +```shell +pip install azure-identity +pip install azure-mgmt-attestation +``` + +Before running the examples, please set the values of the client ID, tenant ID and client secret +of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, +AZURE_CLIENT_SECRET. For more info about how to get the value, please see: +https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal + +### Resources To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) @@ -18,11 +30,55 @@ Code samples for this package can be found at [Attestation Management](https://d Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) -# Provide Feedback +## Examples + +### List Attestation Providers +```python +from azure.core.exceptions import ClientAuthenticationError +from azure.identity import DefaultAzureCredential +from azure.mgmt.attestation import AttestationManagementClient + +client = AttestationManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", +) + +response = client.attestation_providers.list() +print(response) +``` + +## Troubleshooting + +### CredentialUnavailableError +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. + +### Permission issues +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](https://learn.microsoft.com/azure/attestation/) 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. + +## Next Steps If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) -section of the project. - +section of the project. ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-attestation%2FREADME.png) + + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file