private void DeleteAdGroup(ResourcesController controllerAdmin, Group group)
 {
     if (group != null)
     {
         controllerAdmin.GraphClient.Group.Delete(group.ObjectId);
     }
 }
 private void DeleteAdUser(ResourcesController controllerAdmin, User user)
 {
     if (user != null)
     {
         controllerAdmin.GraphClient.User.Delete(user.ObjectId);
     }
 }
 private void DeleteAdApp(ResourcesController controllerAdmin, Application app)
 {
     if (app != null)
     {
         controllerAdmin.GraphClient.Application.Delete(app.ObjectId);
     }
 }
 private void DeleteAdServicePrincipal(ResourcesController controllerAdmin, ServicePrincipal newServicePrincipal)
 {
     if (newServicePrincipal != null)
     {
         controllerAdmin.GraphClient.ServicePrincipal.Delete(newServicePrincipal.ObjectId);
     }
 }
        private ADGroup CreateNewAdGroup(ResourcesController controllerAdmin)
        {
            var parameter = new GroupCreateParameters
            {
                DisplayName  = TestUtilities.GenerateName("adgroup"),
                MailNickname = TestUtilities.GenerateName("adgroupmail")
            };

            return(controllerAdmin.GraphClient.Groups.Create(parameter));
        }
        private ServicePrincipal CreateNewAdServicePrincipal(ResourcesController controllerAdmin, string appId)
        {
            var spParam = new ServicePrincipalCreateParameters
            {
                AppId          = appId,
                AccountEnabled = true
            };

            return(controllerAdmin.GraphClient.ServicePrincipal.Create(spParam).ServicePrincipal);
        }
        private Group CreateNewAdGroup(ResourcesController controllerAdmin)
        {
            var parameter = new GroupCreateParameters
            {
                DisplayName     = TestUtilities.GenerateName("adgroup"),
                MailNickname    = TestUtilities.GenerateName("adgroupmail"),
                SecurityEnabled = true
            };

            return(controllerAdmin.GraphClient.Group.Create(parameter).Group);
        }
        private Application CreateNewAdApp(ResourcesController controllerAdmin)
        {
            var appName  = TestUtilities.GenerateName("adApplication");
            var url      = string.Format("http://{0}/home", appName);
            var appParam = new ApplicationCreateParameters
            {
                AvailableToOtherTenants = false,
                DisplayName             = appName,
                Homepage       = url,
                IdentifierUris = new[] { url },
                ReplyUrls      = new[] { url }
            };

            return(controllerAdmin.GraphClient.Application.Create(appParam).Application);
        }
        private User CreateNewAdUser(ResourcesController controllerAdmin)
        {
            var name      = TestUtilities.GenerateName("aduser");
            var parameter = new UserCreateParameters
            {
                DisplayName             = name,
                UserPrincipalName       = name + "@" + controllerAdmin.UserDomain,
                AccountEnabled          = true,
                MailNickname            = name + "test",
                PasswordProfileSettings = new UserCreateParameters.PasswordProfile
                {
                    ForceChangePasswordNextLogin = false,
                    Password = TestUtilities.GenerateName("adpass") + "0#$"
                }
            };

            return(controllerAdmin.GraphClient.User.Create(parameter).User);
        }
 private ADGroup CreateNewAdGroup(ResourcesController controllerAdmin)
 {
     var parameter = new GroupCreateParameters
     {
         DisplayName = TestUtilities.GenerateName("adgroup"),
         MailNickname = TestUtilities.GenerateName("adgroupmail")
     };
     return controllerAdmin.GraphClient.Groups.Create(parameter);
 }
 private Group CreateNewAdGroup(ResourcesController controllerAdmin)
 {
     var parameter = new GroupCreateParameters
     {
         DisplayName = TestUtilities.GenerateName("adgroup"),
         MailNickname = TestUtilities.GenerateName("adgroupmail"),
         SecurityEnabled = true
     };
     return controllerAdmin.GraphClient.Group.Create(parameter).Group;
 }
        private Application CreateNewAdApp(ResourcesController controllerAdmin)
        {
            var appName = TestUtilities.GenerateName("adApplication");
            var url = string.Format("http://{0}/home", appName);
            var appParam = new ApplicationCreateParameters
            {
                AvailableToOtherTenants = false,
                DisplayName = appName,
                Homepage = url,
                IdentifierUris = new[] { url },
                ReplyUrls = new[] { url }
            };

            return controllerAdmin.GraphClient.Application.Create(appParam).Application;
        }
        private ServicePrincipal CreateNewAdServicePrincipal(ResourcesController controllerAdmin, string appId)
        {
            var spParam = new ServicePrincipalCreateParameters
            {
                AppId = appId,
                AccountEnabled = true
            };

            return controllerAdmin.GraphClient.ServicePrincipal.Create(spParam).ServicePrincipal;
        }
        private User CreateNewAdUser(ResourcesController controllerAdmin)
        {
            var name = TestUtilities.GenerateName("aduser");
            var parameter = new UserCreateParameters
            {
                DisplayName = name,
                UserPrincipalName = name + "@" + controllerAdmin.UserDomain,
                AccountEnabled = true,
                MailNickname = name + "test",
                PasswordProfileSettings = new UserCreateParameters.PasswordProfile
                {
                    ForceChangePasswordNextLogin = false,
                    Password = TestUtilities.GenerateName("adpass") + "0#$"
                }
            };

            return controllerAdmin.GraphClient.User.Create(parameter).User;
        }
 private void DeleteAdServicePrincipal(ResourcesController controllerAdmin, ServicePrincipal newServicePrincipal)
 {
     if (newServicePrincipal != null)
     {
         controllerAdmin.GraphClient.ServicePrincipal.Delete(newServicePrincipal.ObjectId);
     }
 }
 private void DeleteAdApp(ResourcesController controllerAdmin, Application app)
 {
     if (app != null)
     {
         controllerAdmin.GraphClient.Application.Delete(app.ObjectId);
     }
 }
 private void DeleteAdGroup(ResourcesController controllerAdmin, Group group)
 {
     if (group != null)
     {
         controllerAdmin.GraphClient.Group.Delete(group.ObjectId);
     }
 }
 private void DeleteAdUser(ResourcesController controllerAdmin, User user)
 {
     if (user != null)
     {
         controllerAdmin.GraphClient.User.Delete(user.ObjectId);
     }
 }