public SqlAdvancedDataSecurityAdapter(IAzureContext context) { Context = context; Subscription = context?.Subscription; SqlThreatDetectionAdapter = new SqlThreatDetectionAdapter(Context); AzureCommunicator = new AzureEndpointsCommunicator(Context); }
/// <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 managed instance Advanced Data Security policy model for the given managed instance /// </summary> public ManagedInstanceAdvancedDataSecurityPolicyModel SetManagedInstanceAdvancedDataSecurity(ManagedInstanceAdvancedDataSecurityPolicyModel model) { // Currently Advanced Data Security policy is a TD policy until the backend will support Advanced Data Security 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); }
/// <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); }
/// <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); }
public SqlAdvancedThreatProtectionAdapter(IAzureContext context) { Context = context; Subscription = context.Subscription; SqlThreatDetectionAdapter = new SqlThreatDetectionAdapter(Context); }