Ejemplo n.º 1
0
        /// <summary>
        /// Converts the response from the service to a powershell database object
        /// </summary>
        /// <param name="resourceGroupName">The resource group the managed instance is in</param>
        /// <param name="managedInstanceName">The name of the Azure Sql InstanceActiveDirectoryAdministrator Managed Instance</param>
        /// <param name="admin">The service response</param>
        /// <returns>The converted model</returns>
        public static AzureSqlInstanceActiveDirectoryAdministratorModel CreateInstanceActiveDirectoryAdministratorModelFromResponse(string resourceGroup, string managedInstanceName, ManagedInstanceAdministrator admin)
        {
            AzureSqlInstanceActiveDirectoryAdministratorModel model = new AzureSqlInstanceActiveDirectoryAdministratorModel();

            model.ResourceGroupName = resourceGroup;
            model.InstanceName      = managedInstanceName;
            model.DisplayName       = admin.Login;
            model.ObjectId          = admin.Sid;

            return(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates or updates an Azure SQL Instance Active Directory administrator.
        /// </summary>
        /// <param name="resourceGroup">The name of the resource group</param>
        /// <param name="managedInstanceName">The name of the Azure Sql Managed Instance</param>
        /// <param name="model">The input parameters for the create/update operation</param>
        /// <returns>The upserted Azure SQL Instance Active Directory administrator</returns>
        internal AzureSqlInstanceActiveDirectoryAdministratorModel UpsertInstanceActiveDirectoryAdministrator(string resourceGroup, string managedInstanceName, AzureSqlInstanceActiveDirectoryAdministratorModel model)
        {
            var resp = Communicator.CreateOrUpdate(resourceGroup, managedInstanceName, GetActiveDirectoryInformation(model.DisplayName, model.ObjectId));

            return(CreateInstanceActiveDirectoryAdministratorModelFromResponse(resourceGroup, managedInstanceName, resp));
        }