|
| 1 | +# Azure Mgmt Avs client library for Python |
| 2 | +<!-- write necessary description of service --> |
| 3 | + |
| 4 | +## Getting started |
| 5 | + |
| 6 | +### Install the package |
| 7 | + |
| 8 | +```bash |
| 9 | +python -m pip install azure-mgmt-avs |
| 10 | +``` |
| 11 | + |
| 12 | +#### Prequisites |
| 13 | + |
| 14 | +- Python 3.9 or later is required to use this package. |
| 15 | +- You need an [Azure subscription][azure_sub] to use this package. |
| 16 | +- An existing Azure Mgmt Avs instance. |
| 17 | + |
| 18 | +#### Create with an Azure Active Directory Credential |
| 19 | +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], |
| 20 | +provide an instance of the desired credential type obtained from the |
| 21 | +[azure-identity][azure_identity_credentials] library. |
| 22 | + |
| 23 | +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] |
| 24 | + |
| 25 | +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. |
| 26 | +As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: |
| 27 | + |
| 28 | +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: |
| 29 | +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` |
| 30 | + |
| 31 | +Use the returned token credential to authenticate the client: |
| 32 | + |
| 33 | +```python |
| 34 | +>>> from azure.mgmt.avs import AVSClient |
| 35 | +>>> from azure.identity import DefaultAzureCredential |
| 36 | +>>> client = AVSClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) |
| 37 | +``` |
| 38 | + |
| 39 | +## Examples |
| 40 | + |
| 41 | +```python |
| 42 | +>>> from azure.mgmt.avs import AVSClient |
| 43 | +>>> from azure.identity import DefaultAzureCredential |
| 44 | +>>> from azure.core.exceptions import HttpResponseError |
| 45 | + |
| 46 | +>>> client = AVSClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) |
| 47 | +>>> try: |
| 48 | + <!-- write test code here --> |
| 49 | + except HttpResponseError as e: |
| 50 | + print('service responds error: {}'.format(e.response.json())) |
| 51 | + |
| 52 | +``` |
| 53 | + |
| 54 | +## Contributing |
| 55 | + |
| 56 | +This project welcomes contributions and suggestions. Most contributions require |
| 57 | +you to agree to a Contributor License Agreement (CLA) declaring that you have |
| 58 | +the right to, and actually do, grant us the rights to use your contribution. |
| 59 | +For details, visit https://cla.microsoft.com. |
| 60 | + |
| 61 | +When you submit a pull request, a CLA-bot will automatically determine whether |
| 62 | +you need to provide a CLA and decorate the PR appropriately (e.g., label, |
| 63 | +comment). Simply follow the instructions provided by the bot. You will only |
| 64 | +need to do this once across all repos using our CLA. |
| 65 | + |
| 66 | +This project has adopted the |
| 67 | +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, |
| 68 | +see the Code of Conduct FAQ or contact [email protected] with any |
| 69 | +additional questions or comments. |
| 70 | + |
| 71 | +<!-- LINKS --> |
| 72 | +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ |
| 73 | +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token |
| 74 | +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials |
| 75 | +[azure_identity_pip]: https://pypi.org/project/azure-identity/ |
| 76 | +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential |
| 77 | +[pip]: https://pypi.org/project/pip/ |
| 78 | +[azure_sub]: https://azure.microsoft.com/free/ |
0 commit comments