Skip to content

code snippet on web page doesn't work. #18240

Description

@lovettchris
  • Package Name: azure.identity
  • Package Version: 1.5.0
  • Operating System: Windows
  • Python Version: 3.6.13

Describe the bug
This page: https://docs.microsoft.com/en-us/azure/developer/python/azure-sdk-authenticate
contains this snippet:

from azure.identity import AzureCliCredential
from azure.mgmt.resource import SubscriptionClient

credential = AzureCliCredential()
subscription_client = SubscriptionClient(credential)

subscription = next(subscription_client.subscriptions.list())
print(subscription.subscription_id)

but it doesn't work, I get this error:

Exception has occurred: AttributeError
'AzureCliCredential' object has no attribute 'signed_session'
File "D:\Temp\copilot\test.py", line 27, in get_cli_credential
subscription = next(subscription_client.subscriptions.list())
File "D:\Temp\copilot\test.py", line 31, in
get_cli_credential()

To Reproduce
Steps to reproduce the behavior:

  1. Run the above snippet from VS code launched from CLI that you did "az login" already.

Expected behavior
Published code snippets should be tested on an ongoing basis.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

Azure.IdentityClientThis issue points to a problem in the data-plane of the library.Docscustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions