Package: azure-purview-account
Azure Purview Account client library for PythonAzure Purview Account is a fully managed cloud service.Please rely heavily on theservice's documentationand ourclient docsto use this librarySource code|Package (PyPI)|API reference documentation|Product documentationGetting startedPrerequisitesPython 2.7, or 3.6 or later is required to use this package.You must have anAzure subscriptionand aPurviewto use this package.Create a Purview ResourceFollowtheseinstructions to create your Purview resourceInstall the packageInstall the Azure Purview Account client library for Python withpip:pipinstallazure-purview-accountAuthenticate the clientTo use anAzure Active Directory (AAD) token credential,
provide an instance of the desired credential type obtained from theazure-identitylibrary.To authenticate with AAD, you must firstpipinstallazure-identityandenable AAD authentication on your Purview resourceAfter setup, you can choose which type ofcredentialfrom azure.identity to use.
As an example,DefaultAzureCredentialcan 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_SECRETUse the returned token credential to authenticate the client:fromazure.purview.accountimportPurviewAccountClientfromazure.identityimportDefaultAzureCredentialcredential=DefaultAzureCredential()client=PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com",credential=credential)Key conceptsClientExamplesThe following section shows you how to initialize and authenticate your client, then list all of your keys.Get KeysGet Keysfromazure.purview.accountimportPurviewAccountClientfromazure.identityimportDefaultAzureCredentialcredential=DefaultAzureCredential()client=PurviewAccountClient(endpoint="https://<my-account-name>.purview.azure.com",credential=credential)response=client.accounts.get_access_keys()print(response)TroubleshootingGeneralThe Purview Account client will raise exceptions if status code of your responses is not defined.LoggingThis library uses the standardlogginglibrary 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 thelogging_enablekeyword argument:importsysimportloggingfromazure.identityimportDefaultAzureCredentialfromazure.purview.accountimportPurviewAccountClient# Create a logger for the 'azure' SDKlogger=logging.getLogger('azure')logger.setLevel(logging.DEBUG)# Configure a console outputhandler=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 levelclient=PurviewAccountClient(endpoint=endpoint,credential=credential,logging_enable=True)Similarly,logging_enablecan 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 stepsFor more generic samples, see ourclient docs.ContributingThis 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, visitcla.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 theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQor contactopencode@microsoft.comwith any additional questions or comments.Release History1.0.0b1 (2021-08-23)This is the initial release of the Azure Purview Account library.