Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Azure Purview Administration client library for Python

Azure Purview is a fully managed cloud service.

Please rely heavily on the service's documentation to use this library

Source code | Package (PyPI) | API reference documentation| Product documentation

Disclaimer

Azure SDK Python packages support for Python 2.7 is ending 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691

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:

pip install azure-purview-administration

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:

from azure.purview.administration.account import PurviewAccountClient
from azure.purview.administration.metadatapolicies import PurviewMetadataPoliciesClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
endpoint = "https://<my-account-name>.purview.azure.com"
account_client = PurviewAccountClient(endpoint=endpoint, credential=credential)
metadatapolicy_client = PurviewMetadataPoliciesClient(endpoint=endpoint, credential=credential)

Key concepts

Client

The package contains two kinds of client: PurviewAccountClient and PurviewMetadataPoliciesClient. You could use them with one package according to your requirements.

Examples

The following section shows you how to initialize and authenticate your client, then list all of your keys.

Get Keys

from azure.purview.administration.account import PurviewAccountClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
client = PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
response = client.accounts.get_access_keys()
print(response)

The following section shows you how to initialize and authenticate your client, then list all of your roles.

List Roles

from azure.purview.administration.metadatapolicies import PurviewMetadataPoliciesClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
client = PurviewMetadataPoliciesClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
response = client.metadata_roles.list()
result = [item for item in response]
print(result)

Troubleshooting

General

The Purview 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:

import sys
import logging
from azure.identity import DefaultAzureCredential
from azure.purview.administration.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://<my-account-name>.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:

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.

Release History

1.0.0b1 (2021-09-29)

  • This is the initial release of the Azure Purview Administration library.
  • This package includes the operations of azure-purview-account that was previously released

Metadata

Release files for azure-purview-administration 1.0.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-purview-administration 1.0.0b1
File Size Uploaded
azure-purview-administration-1.0.0b1.zip 62.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-purview-administration 1.0.0b1
File Interpreter ABI Platform
azure_purview_administration-1.0.0b1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 106.7 kB

Release files / azure-purview-administration-1.0.0b1.zip

Download URL azure-purview-administration-1.0.0b1.zip
Size 62.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d04271dc3b73904d3b5fbc1ab43c6658ebec53ac84f1c3d4386b76a7e82808d4
BLAKE2b-256 checksum
How to use checksums
724c28f35c83750e5794321108d8b997e185945969138eb91658f21548b1275e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / azure_purview_administration-1.0.0b1-py2.py3-none-any.whl

Download URL azure_purview_administration-1.0.0b1-py2.py3-none-any.whl
Size 44.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
eb070be5a63d34730a4c5b819e73b3e9f7b950d2b1e6f528ef73b89799965458
BLAKE2b-256 checksum
How to use checksums
3789fe37aaa9fde191e916f5ea4e9468bb5395dc6f944b58c47198b118f86ae9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

1.0.0b1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page