Server Advanced Threat Protection Settings - Create Or Update
Service:
SQL Database
API Version:
2023-08-01
Creates or updates an Advanced Threat Protection state.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/advancedThreatProtectionSettings/Default?api-version=2023-08-01
Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been applied yet on the specific database or server.
400 AdvancedThreatProtectionInsufficientDiskSpace - Insufficient disk space to save the Advanced Threat Protection settings metadata in the database
400 UpdateNotAllowedOnServerContainingPausedDWDatabase - Setting the server Advanced Threat Protection settings is not allowed on a server with a paused Data Warehouse database
400 InvalidServerAdvancedThreatProtectionCreateRequest - The create server Advanced Threat Protection request does not exist or has no properties object
400 AdvancedThreatProtectionInvalidUserSuppliedParameter - An invalid parameter value was provided by the client
400 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
400 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
404 SubscriptionDoesNotHaveServer - The requested server was not found
404 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
404 OperationIdNotFound - The operation with Id does not exist.
409 ServerAdvancedThreatProtectionInProgress - Setting the server Advanced Threat Protection settings is already in progress
409 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
409 CannotCancelOperation - The management operation is in a state that cannot be cancelled.
409 OperationCancelled - The operation has been cancelled by user.
409 OperationInterrupted - The operation on the resource could not be completed because it was interrupted by another operation on the same resource.
429 SubscriptionTooManyCreateUpdateRequests - Requests beyond max requests that can be processed by available resources.
429 SubscriptionTooManyRequests - Requests beyond max requests that can be processed by available resources.
500 DatabaseIsUnavailable - Loading failed. Please try again later.
500 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
500 UpsertServerAdvancedThreatProtectionFailed - An error has occurred while saving the Advanced Threat Protection settings, please try again later
500 OperationTimedOut - The operation timed out and automatically rolled back. Please retry the operation.
503 TooManyRequests - Requests beyond max requests that can be processed by available resources.
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default?api-version=2023-08-01
{
"properties": {
"state": "Enabled"
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2023-08-01/examples/ServerAdvancedThreatProtectionSettingsCreateMax.json
// this example is just showing the usage of "ServerAdvancedThreatProtectionSettings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ServerAdvancedThreatProtectionResource created on azure
// for more information of creating ServerAdvancedThreatProtectionResource, please refer to the document of ServerAdvancedThreatProtectionResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "threatprotection-4799";
string serverName = "threatprotection-6440";
AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default;
ResourceIdentifier serverAdvancedThreatProtectionResourceId = ServerAdvancedThreatProtectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, advancedThreatProtectionName);
ServerAdvancedThreatProtectionResource serverAdvancedThreatProtection = client.GetServerAdvancedThreatProtectionResource(serverAdvancedThreatProtectionResourceId);
// invoke the operation
ServerAdvancedThreatProtectionData data = new ServerAdvancedThreatProtectionData
{
State = AdvancedThreatProtectionState.Enabled,
};
ArmOperation<ServerAdvancedThreatProtectionResource> lro = await serverAdvancedThreatProtection.UpdateAsync(WaitUntil.Completed, data);
ServerAdvancedThreatProtectionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ServerAdvancedThreatProtectionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/threatprotection-4799/providers/Microsoft.Sql/servers/threatprotection-6440/advancedThreatProtectionSettings/Default?api-version=2023-08-01
{
"properties": {
"state": "Disabled"
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2023-08-01/examples/ServerAdvancedThreatProtectionSettingsCreateMin.json
// this example is just showing the usage of "ServerAdvancedThreatProtectionSettings_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ServerAdvancedThreatProtectionResource created on azure
// for more information of creating ServerAdvancedThreatProtectionResource, please refer to the document of ServerAdvancedThreatProtectionResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "threatprotection-4799";
string serverName = "threatprotection-6440";
AdvancedThreatProtectionName advancedThreatProtectionName = AdvancedThreatProtectionName.Default;
ResourceIdentifier serverAdvancedThreatProtectionResourceId = ServerAdvancedThreatProtectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, advancedThreatProtectionName);
ServerAdvancedThreatProtectionResource serverAdvancedThreatProtection = client.GetServerAdvancedThreatProtectionResource(serverAdvancedThreatProtectionResourceId);
// invoke the operation
ServerAdvancedThreatProtectionData data = new ServerAdvancedThreatProtectionData
{
State = AdvancedThreatProtectionState.Disabled,
};
ArmOperation<ServerAdvancedThreatProtectionResource> lro = await serverAdvancedThreatProtection.UpdateAsync(WaitUntil.Completed, data);
ServerAdvancedThreatProtectionResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
ServerAdvancedThreatProtectionData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been applied yet on the specific database or server.
Metadata pertaining to creation and last modification of the resource.
AdvancedThreatProtectionName
Enumeration
The name of the Advanced Threat Protection state.
Value
Description
Default
AdvancedThreatProtectionState
Enumeration
Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been applied yet on the specific database or server.
Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been applied yet on the specific database or server.