Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.59k stars 2.81k forks source link

Missing high-level hello world example for certificate principal usage #13061

Closed synergiator closed 2 years ago

synergiator commented 4 years ago

It seems like there is a missing link for beginners how to use certificate principal authorization in a hello world example demonstrating benefits of SDK usage beyond direct API access.

What I have tried/found out so far:

changlong-liu commented 4 years ago

Hi @synergiator ,

We are working at the new generation of Python SDK which use auzre-identity for credential. I think you may need this in azure-identity: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-identity/1.4.0/azure.identity.html#azure.identity.CertificateCredential

Currently 8 packages has released preview versions for the new generation SDK: appconfiguration: https://pypi.org/project/azure-mgmt-appconfiguration/1.0.0b1/ compute: https://pypi.org/project/azure-mgmt-compute/17.0.0b1/ eventhub: https://pypi.org/project/azure-mgmt-eventhub/8.0.0b1/ keyvault: https://pypi.org/project/azure-mgmt-keyvault/7.0.0b1/ monitor: https://pypi.org/project/azure-mgmt-monitor/1.0.0b1/ network: https://pypi.org/project/azure-mgmt-network/16.0.0b1/ resource: https://pypi.org/project/azure-mgmt-resource/15.0.0b1/ storage: https://pypi.org/project/azure-mgmt-storage/16.0.0b1/

synergiator commented 4 years ago

Hi there @changlong-liu, thank you for your reply! I have understood so far there is ongoing work and some beta/preview releases, but what does this mean for MSAL - will it become obsolete? Will be a high-level credential configuration possible with these new packages? If possible, please share an example, can't see it from the referenced docs.

What I'm trying to achieve is something like that:

identity = azure.identity.CertificateCredential(tenant_id, client_id,, certificate_path) # or another statement
subscriptionClient =  (credentials=identity)
subscriptionClient.list()
subscriptionClient.create(..)

Is this currently possible with existing code base?

While Azure CLI is written in Python, what happens actually in the background if I run this command:

az account create ...

That is, there is already some Python code, or are Python SDK and Azure CLI completely separate projects? (in AWS for example, they have botocore as base library, and both SDK boto3 and awscli build on it afaik).

changlong-liu commented 4 years ago

Hi @synergiator , The "az account create" use azure-mgmt-subscription, which has not released the next generation preview.

xiangyan99 commented 2 years ago

@msyyc looks like azure-mgmt-subscription 2.0.0 has released. Could you help to update the issue?

ghost commented 2 years ago

Hi @synergiator. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.