.. role:: raw-html-m2r(raw) :format: html Azure Purview Account client library for Python =============================================== Azure Purview Account is a fully managed cloud service. **Please rely heavily on the `service's documentation `_ and our `client docs `_ to use this library** `Source code `_ | `Package (PyPI) `_ | `API reference documentation `_\ | `Product documentation `_ Getting started --------------- Prerequisites ^^^^^^^^^^^^^ * Python 2.7, or 3.6 or later is required to use this package. * You must have an `Azure subscription `_ and a `Purview `_ to use this package. Create a Purview Resource ~~~~~~~~~~~~~~~~~~~~~~~~~ Follow `these `_ instructions to create your Purview resource Install the package ^^^^^^^^^^^^^^^^^^^ Install the Azure Purview Account client library for Python with `pip `_\ : .. code-block:: bash pip install azure-purview-account Authenticate the client ^^^^^^^^^^^^^^^^^^^^^^^ To use an `Azure Active Directory (AAD) token credential `_\ , provide an instance of the desired credential type obtained from the `azure-identity `_ library. To authenticate with AAD, you must first `pip `_ install `\ ``azure-identity`` `_ and `enable AAD authentication on your Purview resource `_ After setup, you can choose which type of `credential `_ from azure.identity to use. As an example, `DefaultAzureCredential `_ can be used to authenticate the client: 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 Use the returned token credential to authenticate the client: .. code-block:: python from azure.purview.account import PurviewAccountClient from azure.identity import DefaultAzureCredential credential = DefaultAzureCredential() client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) Key concepts ------------ Client ^^^^^^ Examples -------- The following section shows you how to initialize and authenticate your client, then list all of your keys. * :raw-html-m2r:`Get Keys` Get Keys ^^^^^^^^ .. code-block:: python from azure.purview.account import PurviewAccountClient from azure.identity import DefaultAzureCredential credential = DefaultAzureCredential() client = PurviewAccountClient(endpoint="https://.purview.azure.com", credential=credential) response = client.accounts.get_access_keys() print(response) Troubleshooting --------------- General ^^^^^^^ The Purview Account client will raise exceptions if status code of your responses is not defined. Logging ^^^^^^^ This library uses the standard `logging `_ library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level. Detailed DEBUG level logging, including request/response bodies and unredacted headers, can be enabled on a client with the ``logging_enable`` keyword argument: .. code-block:: python import sys import logging from azure.identity import DefaultAzureCredential from azure.purview.account import PurviewAccountClient # Create a logger for the 'azure' SDK logger = logging.getLogger('azure') logger.setLevel(logging.DEBUG) # Configure a console output handler = logging.StreamHandler(stream=sys.stdout) logger.addHandler(handler) endpoint = "https://.purview.azure.com" credential = DefaultAzureCredential() # This client will log detailed information about its HTTP sessions, at DEBUG level client = PurviewAccountClient(endpoint=endpoint, credential=credential, logging_enable=True) Similarly, ``logging_enable`` can enable detailed logging for a single call, even when it isn't enabled for the client: .. code-block:: python result = client.accounts.get_access_keys(logging_enable=True) Next steps ---------- For more generic samples, see our `client docs `_. 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 `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 `_. For more information see the `Code of Conduct FAQ `_ or contact `opencode@microsoft.com `_ with any additional questions or comments. .. raw:: html Indices and tables ------------------ * :ref:`genindex` * :ref:`modindex` * :ref:`search` .. toctree:: :maxdepth: 5 :glob: :caption: Developer Documentation azure.purview.account.rst