Пример #1
0
        /// <summary>
        /// Sets a managed instance Advanced Threat Protection policy model for the given managed instance
        /// </summary>
        public ManagedInstanceAdvancedDataSecurityPolicyModel SetManagedInstanceAdvancedThreatProtection(ManagedInstanceAdvancedDataSecurityPolicyModel model)
        {
            // Currently Advanced Threat Protection policy is a TD policy until the backend will support Advanced Threat Protection APIs
            var threatDetectionPolicy = SqlThreatDetectionAdapter.GetManagedInstanceThreatDetectionPolicy(model.ResourceGroupName, model.ManagedInstanceName);

            threatDetectionPolicy.ThreatDetectionState = model.IsEnabled ? ThreatDetectionStateType.Enabled : ThreatDetectionStateType.Disabled;

            SqlThreatDetectionAdapter.SetManagedInstanceThreatDetectionPolicy(threatDetectionPolicy, AzureEnvironment.Endpoint.StorageEndpointSuffix);

            return(model);
        }
Пример #2
0
        /// <summary>
        /// Provides a managed instance Advanced Data Security policy model for the given managed instance
        /// </summary>
        public ManagedInstanceAdvancedDataSecurityPolicyModel GetManagedInstanceAdvancedDataSecurityPolicy(string resourceGroup, string managedInstanceName)
        {
            // Currently Advanced Threat Protection policy is a TD policy until the backend will support Advanced Threat Protection APIs
            var threatDetectionPolicy = SqlThreatDetectionAdapter.GetManagedInstanceThreatDetectionPolicy(resourceGroup, managedInstanceName);
            var managedInstanceAdvancedDataSecurityPolicy = new ManagedInstanceAdvancedDataSecurityPolicyModel()
            {
                ResourceGroupName   = resourceGroup,
                ManagedInstanceName = managedInstanceName,
                IsEnabled           = (threatDetectionPolicy.ThreatDetectionState == ThreatDetectionStateType.Enabled)
            };

            return(managedInstanceAdvancedDataSecurityPolicy);
        }