question

45024173 avatar image
0 Votes"
45024173 asked 45024173 commented

Getting error in Linux printing Security group in azure

I have this code and I have written it in windows. and it works fine in windows but when I run it on Linux and I have to run it on Linux as of my project needs and it does not work there and gives me the following error

AttributeError: 'ServicePrincipalCredentials' object has no attribute 'get_token'

 from azure.mgmt.security import SecurityCenter
 from azure.common.credentials import ServicePrincipalCredentials
 import Credentials
 from pprint import pprint
    
 client = SecurityCenter(Credentials.credential,Credentials.subscription_id,asc_location="")
    
 for score in client.secure_scores.list():
    print(score)


not-supported
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@45024173
Thank you for your post and I apologize for the delayed response!

  • Can you share any documentation that you followed to set this up?

  • From your error message, can you make sure that your attribute ServicePrincipalCredentials has the correct variables to get a token? For more info - https://stackoverflow.com/a/64087837

    credentials = ServicePrincipalCredentials(client_id="xxx", secret="xxx", tenant="xxx")


Additional Link:
ServicePrincipalCredentials Class
azure-sdk-python forums


If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.

0 Votes 0 ·

@45024173
I just wanted to check in and see if you had any other questions or if you were able to resolve this issue?

0 Votes 0 ·
45024173 avatar image 45024173 JamesTran-MSFT ·

Thank you sir this problem was resolved.

0 Votes 0 ·

0 Answers