use of com.microsoft.azuretools.authmanage.srvpri.entities.ServicePrincipal in project azure-tools-for-java by Microsoft.
the class ServicePrincipalStep method createAadServicePrincipal.
// helpers
// Create Service Principals
private ServicePrincipalRet createAadServicePrincipal(UUID appId) throws IOException {
/*
POST https://graph.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/servicePrincipals?api-version=1.6-internal HTTP/1.1
{
"appId": "425817b6-1cd8-48ea-9cd7-1b9472912bee",
"accountEnabled": true
}
*/
ServicePrincipal sp = new ServicePrincipal();
sp.accountEnabled = true;
sp.appId = appId;
ObjectMapper mapper = new ObjectMapper();
String spJson = mapper.writeValueAsString(sp);
String resp = graphRestHelper.doPost("servicePrincipals", null, spJson);
ServicePrincipalRet spr = mapper.readValue(resp, ServicePrincipalRet.class);
return spr;
}
Aggregations