python 3.x - How to properly use "get_token" of "ManagedIdentityCredential" of azure identity - Stack Overflow
Generate longer token for Databricks with Azure.
python - How to get bearer token from Azure SDK DefaultCredential - Stack Overflow
Python azure-identity ClientSecretCredential - Stack Overflow
When I use the .net Microsoft.IdentityModel.Clients.ActiveDirectory library I don’t have to think about scope.
Actually, you have thought about it. When you use the code below via .net sdk, there is an aasUrl, this is the equivalent you need to specify in python sdk.
AuthenticationResult authenticationResult = await authContext.AcquireTokenAsync(aasUrl, clientCred);
With Microsoft.IdentityModel.Clients.ActiveDirectory, the method AcquireTokenAsync essentially uses the Azure AD client credential flow v1.0 endpoint to get the token, so this parameter is named as resource, i.e. the resource parameter in this method AcquireTokenAsync(String, ClientCredential).
In python sdk azure.identity, this method get_token essentially uses Azure AD client credential flow v2.0 endpoint to get the token, when v1.0 endpoint migrates to v2.0, there are some changes, one of them is the resource, it changed to scope, see this doc. When using scope, you need to specify the permission you want to access, you can also use /.default, then by default all the permissions added to the app will be requested.
So in your case, you just need to use the scope as aasUrl/.default, e.g. https://management.azure.com/.default, it depends on yourself.
token = credential.get_token("https://management.azure.com/.default")
Also have a test with the code on my side, it works fine.

if you are using Graph API you could use as
https://graph.microsoft.com/.default
https://graph.microsoft.com/Directory.Read
https://graph.microsoft.com/user_impersonation
if you are using Azure Resource Manager API then the base uri would be https://management.core.windows.net followed by the necessary permission.
If you want to acquire a token for all the static scopes of a v1.0 application, append ".default" to the app ID URI of the API
You Will see the APP Id uri in the Application Overview page

if you have not created app id uri, you set the uri and add permission scope
