示例#1
0
        //Get ApplicationId for the given ObjectId.
        private Guid GetApplicationId()
        {
            GraphRbacManagementClient graphClient = AzureSession.Instance.ClientFactory.CreateArmClient <GraphRbacManagementClient>(
                DefaultProfile.DefaultContext, AzureEnvironment.Endpoint.Graph);

            graphClient.TenantID = DefaultProfile.DefaultContext.Tenant.Id.ToString();

            Microsoft.Azure.Graph.RBAC.Models.ServicePrincipal sp = graphClient.ServicePrincipals.Get(ObjectId.ToString());

            var applicationId = Guid.Empty;

            Guid.TryParse(sp.AppId, out applicationId);
            Debug.Assert(applicationId != Guid.Empty);
            return(applicationId);
        }
 private void DeleteAdServicePrincipal(ResourcesController controllerAdmin, ServicePrincipal newServicePrincipal)
 {
     if (newServicePrincipal != null)
     {
         controllerAdmin.GraphClient.ServicePrincipal.Delete(newServicePrincipal.ObjectId);
     }
 }