/// <summary> /// Sets a server Advanced Threat Protection policy model for the given database /// </summary> public ServerAdvancedThreatProtectionPolicyModel SetServerAdvancedThreatProtection(ServerAdvancedThreatProtectionPolicyModel model) { // Currently Advanced Threat Protection policy is a TD policy until the backend will support Advanced Threat Protection APIs var threatDetectionPolicy = SqlThreatDetectionAdapter.GetServerThreatDetectionPolicy(model.ResourceGroupName, model.ServerName); threatDetectionPolicy.ThreatDetectionState = model.IsEnabled ? ThreatDetectionStateType.Enabled : ThreatDetectionStateType.Disabled; SqlThreatDetectionAdapter.SetServerThreatDetectionPolicy(threatDetectionPolicy, AzureEnvironment.Endpoint.StorageEndpointSuffix); return(model); }
/// <summary> /// Sets a server Advanced Data Security policy model for the given server /// </summary> public ServerAdvancedDataSecurityPolicyModel SetServerAdvancedDataSecurity(ServerAdvancedDataSecurityPolicyModel model, string storageEndpointSuffix) { // Currently Advanced Data Security policy is a TD policy until the backend will support Advanced Data Security APIs var threatDetectionPolicy = SqlThreatDetectionAdapter.GetServerThreatDetectionPolicy(model.ResourceGroupName, model.ServerName); threatDetectionPolicy.ThreatDetectionState = model.IsEnabled ? ThreatDetectionStateType.Enabled : ThreatDetectionStateType.Disabled; SqlThreatDetectionAdapter.SetServerThreatDetectionPolicy(threatDetectionPolicy, storageEndpointSuffix); return(model); }
/// <summary> /// Provides a server Advanced Threat Protection policy model for the given database /// </summary> public ServerAdvancedThreatProtectionPolicyModel GetServerAdvancedThreatProtectionPolicy(string resourceGroup, string serverName) { // Currently Advanced Threat Protection policy is a TD policy until the backend will support Advanced Threat Protection APIs var threatDetectionPolicy = SqlThreatDetectionAdapter.GetServerThreatDetectionPolicy(resourceGroup, serverName); var serverAdvancedThreatProtectionPolicyModel = new ServerAdvancedThreatProtectionPolicyModel() { ResourceGroupName = resourceGroup, ServerName = serverName, IsEnabled = (threatDetectionPolicy.ThreatDetectionState == ThreatDetectionStateType.Enabled) }; return(serverAdvancedThreatProtectionPolicyModel); }