0

I'm attempting to programmatically register Service Principals in Azure AD using Python. It looks like I should be using the ServicePrincipalsOperations class, however the documentation does not clearly outline what is needed for the parameters. It appears that it is expecting data from other classes within azure.graphrbac, but the documentation is unclear.

I think I should be using the azure.graphrbac.GraphRbacManagementClient to generate the client parameter for ServicePrincipalsOperations, but that's just a guess at this point.

Similarly, I suspect that I would need to use azure.graphrbac.models.ServicePrincipalCreateParameters for the config parameter.

Has anyone successfully registered a Service Principal using Python that may be able to shed more light on these parameters?

Thanks in advance!

Masoud
  • 1,270
  • 7
  • 12
gpowers
  • 3
  • 4

1 Answers1

0

So you can use this test as a reference, but the documents do specify what you need to pass in to the method to create a service principal.

Sample code:

self.graphrbac_client.service_principals.create({
    'app_id': app.app_id, # Do NOT use app.object_id
    'account_enabled': False
})

More reading: Create service principal programmatically in Azure Python API

4c74356b41
  • 69,186
  • 6
  • 100
  • 141