'ClientSecretCredential' object has no attribute 'signed_session'
- Package Name: azure-identity
- Package Version: 1.5.0
- Package Name: azure-mgmt-managementgroups
- Package Version: 0.2.0
- Operating System: linux
- Python Version: 3.8.5
Describe the bug
from azure.identity import ClientSecretCredential
import azure.mgmt.managementgroups
azure_credential = ClientSecretCredential(
client_id=xxxxxxx,
client_secret=xxxxxx,
tenant_id=xxxxx)
management_client = azure.mgmt.managementgroups.ManagementGroupsAPI(azure_credential)
mgmt_groups = management_client.management_groups.get(
"test",
expand='children'
)
subs = []
for record in mgmt_groups.children:
subs.append(record.name)
This is giving an error AttributeError: 'ClientSecretCredential' object has no attribute 'signed_session'
Additional context
Authentication with ClientSecretCredential to resources library and subscription library is working but not to Management Groups
Edit: azure-mgmt-managementgroups 1.0.0 is available now, with support for azure-identity credentials. I recommend ugprading to that version. My suggestions below apply only to lower versions of azure-mgmt-managementgroups.
The latest version of ManagementGroupsAPI doesn't support credentials from azure-identity (a future version might, @msyyc for any comment on the roadmap). It expects an msrestazure authentication class. There are a couple ways you can move forward:
- Use msrestazure.azure_active_directory.ServicePrincipalCredentials instead of ClientSecretCredential
- Use AzureIdentityCredentialWrapper to wrap ClientSecretCredential
AzureIdentityCredentialWrapper is convenient if your application also uses clients expecting azure-identity credentials. If your application uses only ManagementGroupsAPI, or uses only clients expecting the msrestazure API, I'd suggest using ServicePrincipalCredentials.
(Related: #9756, #10274, #14499, #15330)
Close this as it's duplicated with https://github.com/Azure/azure-sdk-for-python/issues/16923