You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This requires too much permissions for the application (I've only managed to get it work with Directory.ReadAll, doesnt work with Application.ReadWrite.All, for some reason despite docs saying it should). All the methods I seem to find seem to require to know objectId upfront... which is what I'm trying to retrieve.
defresolve_service_principal(identifier):
"""Get an object_id from a client_id. """graphrbac_credentials=ServicePrincipalCredentials(
client_id=os.environ['AZURE_CLIENT_ID'],
secret=os.environ['AZURE_CLIENT_SECRET'],
tenant=os.environ['AZURE_TENANT_ID'],
resource="https://graph.windows.net"
)
graphrbac_client=GraphRbacManagementClient(
graphrbac_credentials,
os.environ['AZURE_TENANT_ID']
)
result=list(graphrbac_client.service_principals.list(filter="servicePrincipalNames/any(c:c eq '{}')".format(identifier)))
ifresult:
returnresult[0].object_idraiseRuntimeError("Unable to get object_id from client_id")
This requires too much permissions for the application (I've only managed to get it work with Directory.ReadAll, doesnt work with Application.ReadWrite.All, for some reason despite docs saying it should). All the methods I seem to find seem to require to know objectId upfront... which is what I'm trying to retrieve.
The text was updated successfully, but these errors were encountered: