protected override M ApplyUserInputToModel(M model)
        {
            base.ApplyUserInputToModel(model);

            // Verify that ATP is ON - if ATP is off the GetServerAdvancedThreatProtectionPolicy() will throw a not found exception
            var sqlAdvancedThreatProtectionAdapter = new SqlAdvancedThreatProtectionAdapter(DefaultProfile.DefaultContext);

            if (GetResourceTypeVaAppliesTo() == ApplyToType.Database)
            {
                var atpPolicy = sqlAdvancedThreatProtectionAdapter.GetServerAdvancedThreatProtectionPolicy(ResourceGroupName, GetServerName());
                if (!atpPolicy.IsEnabled)
                {
                    throw new Exception(Resources.ServerAdvancedThreatProtectionIsNotDefined);
                }
            }
            else
            {
                var atpPolicy = sqlAdvancedThreatProtectionAdapter.GetManagedInstanceAdvancedThreatProtectionPolicy(ResourceGroupName, GetServerName());
                if (!atpPolicy.IsEnabled)
                {
                    throw new Exception(Resources.ManagedInstanceAdvancedThreatProtectionIsNotDefined);
                }
            }

            return(model);
        }
        protected override M ApplyUserInputToModel(M model)
        {
            base.ApplyUserInputToModel(model);

            // Verify that ATP is ON - if ATP is off the GetServerAdvancedThreatProtectionPolicy() will throw a not found exception
            var sqlAdvancedThreatProtectionAdapter = new SqlAdvancedThreatProtectionAdapter(DefaultProfile.DefaultContext);
            var atpPolicy = sqlAdvancedThreatProtectionAdapter.GetServerAdvancedThreatProtectionPolicy(ResourceGroupName, ServerName);

            if (!atpPolicy.IsEnabled)
            {
                throw new Exception(Properties.Resources.ServerAdvancedThreatProtectionIsNotDefined);
            }

            return(model);
        }