Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current azure-cli-core not compatible with track2 management libraries #14212

Closed
kraigb opened this issue Oct 2, 2020 · 8 comments
Closed

Current azure-cli-core not compatible with track2 management libraries #14212

kraigb opened this issue Oct 2, 2020 · 8 comments
Assignees
Labels
Azure.Core Azure.Identity Client This issue points to a problem in the data-plane of the library. Mgmt This issue is related to a management-plane library. Track2

Comments

@kraigb
Copy link

kraigb commented Oct 2, 2020

  • Package Name: azure-cli-core
  • Package Version: 2.12.1
  • Operating System:
  • Python Version: 3.8

Describe the bug

I’m working on updating the Python Developer Center's example pages for track 2 management libraries, starting with https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-example-resource-group (and its peers in the TOC).

These examples use azure.common.client_factory.get_client_from_cli_profile because these are provisioning scripts that are equivalent to what one might do with the Azure CLI. Thus it’s appropriate to use the CLI profile login rather than using a method like DefaultAzureCredential (which apparently doesn't use CLI credentials etc.), because the latter requires that the service principal in question has been assigned the appropriate role permissions. Although it's possible to just assign the SP some very broad role, I'd rather not add that (potentially dangerous) complexity to the examples. By using the CLI profile, it's clear that you're inheriting that profile's permissions.

Unfortunately, it appears that the azure-cli-core library hasn't been updated and still has dependencies v10.2.0 of azure-mgmt-resource. If I attempt to use the track 2 azure-mgmt-resource library instead, I end up getting warnings about incompatible versions of msal and msal-extensions.

Specifically, if I install azure-mgmt-resource (v15), and the install azure-cli-core, it forcibly regresses azure-mgmt-resource to v10 and reports:

ERROR: azure-identity 1.4.0 has requirement msal<2.0.0,>=1.3.0, but you'll have msal 1.0.0 which is incompatible.
ERROR: azure-identity 1.4.0 has requirement msal-extensions~=0.2.2, but you'll have msal-extensions 0.1.3 which is incompatible.

That said, if I install azure-cli-core first, then install v15 of azure-mgmt-resource and ignore the incompatibility error, the code actually works. (Error is: ERROR: azure-cli-core 2.12.1 has requirement azure-mgmt-resource==10.2.0, but you'll have azure-mgmt-resource 15.0.0 which is incompatible.) But this of course is not a viable workaround for customers.

To Reproduce
See above
1.

Expected behavior
There's a version of azure-cli-core that's compatible with track2 libraries.

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 2, 2020
@yonzhan
Copy link

yonzhan commented Oct 2, 2020

azure-cli-core

@lmazuel
Copy link
Member

lmazuel commented Oct 3, 2020

@chlowell I'd like your two cents on CLI auth and azure-identity.

@kraigb we are trying to deprecate azure-common, so I wonder if we should not take a step back and rewrite a little more with azure-identity instead

@lmazuel lmazuel added Azure.Core Azure.Identity Client This issue points to a problem in the data-plane of the library. Mgmt This issue is related to a management-plane library. labels Oct 3, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Oct 3, 2020
@chlowell
Copy link
Member

chlowell commented Oct 5, 2020

As of azure-identity 1.4.0, applications can use either AzureCliCredential or DefaultAzureCredential to authenticate as the identity signed in to the CLI. This is implemented by invoking the CLI in a subprocess, so I expect it's less performant than azure-cli-core but still acceptable for local development and scripting.

@kraigb
Copy link
Author

kraigb commented Oct 5, 2020

OK, so examples that have been using azure.common.client_factory.get_client_from_cli_profile should be switched over to using AzureCliCredential, correct? I tried it and it worked as expected (without needing a role assignment), but I want to make sure that AzureCliCredential is intended to be used in this way.

@lmazuel Changing to AzureCliCredential will mean removing azure.common references, except for one piece in the auth article that notes the legacy usage. However, I can't full make that change until the azure.mgmt.web and azure.mgmt.rdbms libraries are updated to track2.

@chlowell
Copy link
Member

chlowell commented Oct 6, 2020

Right, there's nothing special about AzureCliCredential for clients. To a client it's just another credential. So instead of calling get_client_from_cli_profile you would construct a client as usual, giving it an instance of AzureCliCredential.

@kraigb
Copy link
Author

kraigb commented Oct 7, 2020

@lmazuel Given the discussion here, is it proper to not expect azure-cli-core to be suitably updated for track2? If that's the case, then I can close this issue.

@jsntcy
Copy link
Member

jsntcy commented Oct 10, 2020

@kraigb , if we need update azure-cli-core, we'll create issue in https://github.com/Azure/azure-cli/issues for us to track as this repo is only for python SDK.

@lmazuel , please help confirm.
cc @jiasli

@jsntcy jsntcy added the Track2 label Oct 15, 2020
@lmazuel
Copy link
Member

lmazuel commented Dec 30, 2020

Closing this issue, since as @kraigb said it is not an aim anymore to consider azure-cli-core installable by SDKs. Please use azure-identity instead. People reading this issue, you might want to follow when the support for azure-identity is coming to your SDK package here: #9310

@lmazuel lmazuel closed this as completed Dec 30, 2020
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue May 25, 2021
Web ant93 release: Updating API version to 2021-01-01 (Azure#14489)

* Adds base for updating Microsoft.Web from version stable/2020-12-01 to version 2021-01-01

* Updates readme

* Updates API version in new specs and examples

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.… (Azure#14212)

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Add custom word

* Actually bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Update AppServicePlan.json with preoperty (Azure#14388)

Adding ElasticScaleEnabled to ASP object!

* Swagger changes for kubeenv (Azure#14417)

* Swagger changes for kubeenv

* Add examples for create and update

* Fixing model validations in examples

* Supress systemData for kubeenvironments.json

* Making small change to trigger a re-run of ApiReview runner

* Fixing extendedLocation bug in swagger

* fix model validation

* Carry over missing Acr properties from previous version (Azure#14490)

* [python]Update readme.python.md (Azure#14493)

* Update readme.python.md

* Update readme.md

Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue May 25, 2021
Web ant93 release: Updating API version to 2021-01-01 (Azure#14489)

* Adds base for updating Microsoft.Web from version stable/2020-12-01 to version 2021-01-01

* Updates readme

* Updates API version in new specs and examples

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.… (Azure#14212)

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Add custom word

* Actually bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Update AppServicePlan.json with preoperty (Azure#14388)

Adding ElasticScaleEnabled to ASP object!

* Swagger changes for kubeenv (Azure#14417)

* Swagger changes for kubeenv

* Add examples for create and update

* Fixing model validations in examples

* Supress systemData for kubeenvironments.json

* Making small change to trigger a re-run of ApiReview runner

* Fixing extendedLocation bug in swagger

* fix model validation

* Carry over missing Acr properties from previous version (Azure#14490)

* [python]Update readme.python.md (Azure#14493)

* Update readme.python.md

* Update readme.md

Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>
msyyc added a commit that referenced this issue May 25, 2021
* CodeGen from PR 14489 in Azure/azure-rest-api-specs
Web ant93 release: Updating API version to 2021-01-01 (#14489)

* Adds base for updating Microsoft.Web from version stable/2020-12-01 to version 2021-01-01

* Updates readme

* Updates API version in new specs and examples

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.… (#14212)

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Add custom word

* Actually bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Update AppServicePlan.json with preoperty (#14388)

Adding ElasticScaleEnabled to ASP object!

* Swagger changes for kubeenv (#14417)

* Swagger changes for kubeenv

* Add examples for create and update

* Fixing model validations in examples

* Supress systemData for kubeenvironments.json

* Making small change to trigger a re-run of ApiReview runner

* Fixing extendedLocation bug in swagger

* fix model validation

* Carry over missing Acr properties from previous version (#14490)

* [python]Update readme.python.md (#14493)

* Update readme.python.md

* Update readme.md

Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>

* version,CHANGELOG

* test

* test fix

Co-authored-by: SDKAuto <[email protected]>
Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
msyyc added a commit that referenced this issue May 25, 2021
* CodeGen from PR 14489 in Azure/azure-rest-api-specs
Web ant93 release: Updating API version to 2021-01-01 (#14489)

* Adds base for updating Microsoft.Web from version stable/2020-12-01 to version 2021-01-01

* Updates readme

* Updates API version in new specs and examples

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.… (#14212)

* Bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Add custom word

* Actually bring in swagger for Microsoft.CertificateRegistration and Microsoft.DomainRegistration RPs

* Update AppServicePlan.json with preoperty (#14388)

Adding ElasticScaleEnabled to ASP object!

* Swagger changes for kubeenv (#14417)

* Swagger changes for kubeenv

* Add examples for create and update

* Fixing model validations in examples

* Supress systemData for kubeenvironments.json

* Making small change to trigger a re-run of ApiReview runner

* Fixing extendedLocation bug in swagger

* fix model validation

* Carry over missing Acr properties from previous version (#14490)

* [python]Update readme.python.md (#14493)

* Update readme.python.md

* Update readme.md

Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>

* version,CHANGELOG

* test

* test fix

Co-authored-by: SDKAuto <[email protected]>
Co-authored-by: jocawtho <[email protected]>
Co-authored-by: JennyLawrance <[email protected]>
Co-authored-by: msyyc <[email protected]>
Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Azure.Identity Client This issue points to a problem in the data-plane of the library. Mgmt This issue is related to a management-plane library. Track2
Projects
None yet
Development

No branches or pull requests

5 participants