Executes a Vulnerability Assessment database scan.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/default/scans/{scanId}/initiateScan?api-version=2023-08-01
URI Parameters
Name
In
Required
Type
Description
databaseName
path
True
string
The name of the database.
resourceGroupName
path
True
string
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
scanId
path
True
string
The vulnerability assessment scan Id of the scan to retrieve.
serverName
path
True
string
The name of the server.
subscriptionId
path
True
string
The subscription ID that identifies an Azure subscription.
400 InvalidVulnerabilityAssessmentOperationRequest - The vulnerability assessment operation request does not exist or has no properties object.
400 DataSecurityInvalidUserSuppliedParameter - An invalid parameter value was provided by the client.
400 InvalidVulnerabilityAssessmentScanIdLength - The vulnerability assessment scan ID length must be below {0} characters.
400 DatabaseVulnerabilityAssessmentMissingStorageContainerPath - Storage container path must be provided if it isn't set in server level policy
400 VulnerabilityAssessmentDatawarehouseDatabaseIsDeactivated - Could not execute Vulnerability Assessment operation because the database is paused. Please resume it.
400 VulnerabilityAssessmentInvalidPolicy - Vulnerability Assessment settings don't exist or invalid storage specified in settings.
400 VulnerabilityAssessmentStorageOutboundFirewallNotAllowed - The storage account is not in the list of Outbound Firewall Rules.
400 VulnerabilityAssessmentADSIsDisabled - Advanced Data Security should be enabled in order to use Vulnerability Assessment.
400 InvalidStorageAccountName - The provided storage account is not valid or does not exist.
400 InvalidStorageAccountCredentials - The provided storage account shared access signature or account storage key is not valid.
404 DatabaseDoesNotExist - User has specified a database name that does not exist on this server instance.
404 SubscriptionDoesNotHaveServer - The requested server was not found
404 SourceDatabaseNotFound - The source database does not exist.
404 OperationIdNotFound - The operation with Id does not exist.
409 VulnerabilityAssessmentStoragelessIsEnabled - Vulnerability Assessment is enabled on this server or one of its underlying databases with an incompatible version. Additional troubleshooting information can be found https://aka.ms/SQLVAStoragelessDocumentation.
409 DatabaseVulnerabilityAssessmentScanIsAlreadyInProgress - Vulnerability Assessment scan is already in progress.
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 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.
Examples
Executes a database's vulnerability assessment scan.
POST https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityassessmenttest-4711/providers/Microsoft.Sql/servers/vulnerabilityassessmenttest-6411/databases/testdb/vulnerabilityAssessments/default/scans/scan01/initiateScan?api-version=2023-08-01
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/DatabaseVulnerabilityAssessmentScansExecute.json
// this example is just showing the usage of "DatabaseVulnerabilityAssessmentScans_InitiateScan" 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 SqlDatabaseVulnerabilityAssessmentScanResource created on azure
// for more information of creating SqlDatabaseVulnerabilityAssessmentScanResource, please refer to the document of SqlDatabaseVulnerabilityAssessmentScanResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "vulnerabilityassessmenttest-4711";
string serverName = "vulnerabilityassessmenttest-6411";
string databaseName = "testdb";
VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default;
string scanId = "scan01";
ResourceIdentifier sqlDatabaseVulnerabilityAssessmentScanResourceId = SqlDatabaseVulnerabilityAssessmentScanResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId);
SqlDatabaseVulnerabilityAssessmentScanResource sqlDatabaseVulnerabilityAssessmentScan = client.GetSqlDatabaseVulnerabilityAssessmentScanResource(sqlDatabaseVulnerabilityAssessmentScanResourceId);
// invoke the operation
await sqlDatabaseVulnerabilityAssessmentScan.InitiateScanAsync(WaitUntil.Completed);
Console.WriteLine("Succeeded");