Erstellt oder aktualisiert die Sicherheitsrisikobewertung des Servers. Weitere Informationen zum Festlegen der SQL-Sicherheitsrisikobewertung mit verwalteter Identität – https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/vulnerabilityAssessments/default?api-version=2025-01-01
URI-Parameter
| Name |
In |
Erforderlich |
Typ |
Beschreibung |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.
|
|
serverName
|
path |
True
|
string
|
Name des Servers
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
Die ID des Zielabonnements. Der Wert muss eine UUID sein.
|
|
vulnerabilityAssessmentName
|
path |
True
|
VulnerabilityAssessmentName
|
Der Name der Sicherheitsrisikobewertung.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
Die API-Version, die für diesen Vorgang verwendet werden soll.
|
Anforderungstext
| Name |
Erforderlich |
Typ |
Beschreibung |
|
properties.storageContainerPath
|
True
|
string
|
Ein Blobspeichercontainerpfad zum Speichern der Scanergebnisse (z. B. https://myStorage.blob.core.windows.net/VaScans/).
|
|
properties.recurringScans
|
|
VulnerabilityAssessmentRecurringScansProperties
|
Die Einstellungen für wiederkehrende Scans
|
|
properties.storageAccountAccessKey
|
|
string
|
Gibt den Bezeichnerschlüssel des Speicherkontos für Überprüfungsergebnisse der Sicherheitsrisikobewertung an. Wenn "StorageContainerSasKey" nicht angegeben ist, ist "storageAccountAccessKey" erforderlich. Gilt nur, wenn sich das Speicherkonto nicht hinter einem Vnet oder einer Firewall befindet.
|
|
properties.storageContainerSasKey
|
|
string
|
Eine freigegebene Zugriffssignatur (SAS Key), die Schreibzugriff auf den blob-Container hat, der im Parameter "storageContainerPath" angegeben ist. Wenn "storageAccountAccessKey" nicht angegeben ist, ist StorageContainerSasKey erforderlich. Gilt nur, wenn sich das Speicherkonto nicht hinter einem Vnet oder einer Firewall befindet.
|
Antworten
Sicherheit
azure_auth
Azure Active Directory OAuth2 Flow.
Typ:
oauth2
Ablauf:
implicit
Autorisierungs-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiche
| Name |
Beschreibung |
|
user_impersonation
|
Identitätswechsel ihres Benutzerkontos
|
Beispiele
Create a server's vulnerability assessment with all parameters
Beispielanforderung
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default?api-version=2025-01-01
{
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": true,
"emails": [
"email1@mail.com",
"email2@mail.com"
],
"isEnabled": true
},
"storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
import com.azure.resourcemanager.sql.fluent.models.ServerVulnerabilityAssessmentInner;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentName;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentRecurringScansProperties;
import java.util.Arrays;
/**
* Samples for ServerVulnerabilityAssessments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateMax.json
*/
/**
* Sample code: Create a server's vulnerability assessment with all parameters.
*
* @param manager Entry point to SqlServerManager.
*/
public static void
createAServerSVulnerabilityAssessmentWithAllParameters(com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getServerVulnerabilityAssessments().createOrUpdateWithResponse(
"vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", VulnerabilityAssessmentName.DEFAULT,
new ServerVulnerabilityAssessmentInner()
.withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
.withStorageContainerSasKey("fakeTokenPlaceholder").withStorageAccountAccessKey("fakeTokenPlaceholder")
.withRecurringScans(new VulnerabilityAssessmentRecurringScansProperties().withIsEnabled(true)
.withEmailSubscriptionAdmins(true).withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python server_vulnerability_assessment_create_max.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.server_vulnerability_assessments.create_or_update(
resource_group_name="vulnerabilityaseessmenttest-4799",
server_name="vulnerabilityaseessmenttest-6440",
vulnerability_assessment_name="default",
parameters={
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": True,
"emails": ["email1@mail.com", "email2@mail.com"],
"isEnabled": True,
},
"storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
}
},
)
print(response)
# x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateMax.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
*
* @summary creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateMax.json
*/
async function createAServerVulnerabilityAssessmentWithAllParameters() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.serverVulnerabilityAssessments.createOrUpdate(
"vulnerabilityaseessmenttest-4799",
"vulnerabilityaseessmenttest-6440",
"default",
{
recurringScans: {
emailSubscriptionAdmins: true,
emails: ["email1@mail.com", "email2@mail.com"],
isEnabled: true,
},
storageAccountAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
storageContainerPath: "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
storageContainerSasKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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/SQL/stable/2025-01-01/examples/ServerVulnerabilityAssessmentCreateMax.json
// this example is just showing the usage of "ServerVulnerabilityAssessments_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 SqlServerVulnerabilityAssessmentResource created on azure
// for more information of creating SqlServerVulnerabilityAssessmentResource, please refer to the document of SqlServerVulnerabilityAssessmentResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "vulnerabilityaseessmenttest-4799";
string serverName = "vulnerabilityaseessmenttest-6440";
VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default;
ResourceIdentifier sqlServerVulnerabilityAssessmentResourceId = SqlServerVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName);
SqlServerVulnerabilityAssessmentResource sqlServerVulnerabilityAssessment = client.GetSqlServerVulnerabilityAssessmentResource(sqlServerVulnerabilityAssessmentResourceId);
// invoke the operation
SqlServerVulnerabilityAssessmentData data = new SqlServerVulnerabilityAssessmentData
{
StorageContainerPath = "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
StorageContainerSasKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
StorageAccountAccessKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
RecurringScans = new VulnerabilityAssessmentRecurringScansProperties
{
IsEnabled = true,
EmailSubscriptionAdmins = true,
Emails = { "email1@mail.com", "email2@mail.com" },
},
};
ArmOperation<SqlServerVulnerabilityAssessmentResource> lro = await sqlServerVulnerabilityAssessment.UpdateAsync(WaitUntil.Completed, data);
SqlServerVulnerabilityAssessmentResource 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
SqlServerVulnerabilityAssessmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": true,
"emails": [
"email1@mail.com",
"email2@mail.com"
],
"isEnabled": true
}
}
}
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": true,
"emails": [
"email1@mail.com",
"email2@mail.com"
],
"isEnabled": true
}
}
}
Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is specified
Beispielanforderung
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default?api-version=2025-01-01
{
"properties": {
"storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/"
}
}
import com.azure.resourcemanager.sql.fluent.models.ServerVulnerabilityAssessmentInner;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentName;
/**
* Samples for ServerVulnerabilityAssessments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json
*/
/**
* Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is
* specified.
*
* @param manager Entry point to SqlServerManager.
*/
public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified(
com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getServerVulnerabilityAssessments().createOrUpdateWithResponse(
"vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", VulnerabilityAssessmentName.DEFAULT,
new ServerVulnerabilityAssessmentInner()
.withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
.withStorageAccountAccessKey("fakeTokenPlaceholder"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python server_vulnerability_assessment_create_storage_access_key_min.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.server_vulnerability_assessments.create_or_update(
resource_group_name="vulnerabilityaseessmenttest-4799",
server_name="vulnerabilityaseessmenttest-6440",
vulnerability_assessment_name="default",
parameters={
"properties": {
"storageAccountAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
}
},
)
print(response)
# x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
*
* @summary creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json
*/
async function createAServerVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.serverVulnerabilityAssessments.createOrUpdate(
"vulnerabilityaseessmenttest-4799",
"vulnerabilityaseessmenttest-6440",
"default",
{
storageAccountAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
storageContainerPath: "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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/SQL/stable/2025-01-01/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json
// this example is just showing the usage of "ServerVulnerabilityAssessments_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 SqlServerVulnerabilityAssessmentResource created on azure
// for more information of creating SqlServerVulnerabilityAssessmentResource, please refer to the document of SqlServerVulnerabilityAssessmentResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "vulnerabilityaseessmenttest-4799";
string serverName = "vulnerabilityaseessmenttest-6440";
VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default;
ResourceIdentifier sqlServerVulnerabilityAssessmentResourceId = SqlServerVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName);
SqlServerVulnerabilityAssessmentResource sqlServerVulnerabilityAssessment = client.GetSqlServerVulnerabilityAssessmentResource(sqlServerVulnerabilityAssessmentResourceId);
// invoke the operation
SqlServerVulnerabilityAssessmentData data = new SqlServerVulnerabilityAssessmentData
{
StorageContainerPath = "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
StorageAccountAccessKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
};
ArmOperation<SqlServerVulnerabilityAssessmentResource> lro = await sqlServerVulnerabilityAssessment.UpdateAsync(WaitUntil.Completed, data);
SqlServerVulnerabilityAssessmentResource 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
SqlServerVulnerabilityAssessmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": false,
"emails": [],
"isEnabled": true
}
}
}
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": false,
"emails": [],
"isEnabled": true
}
}
}
Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is specified
Beispielanforderung
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default?api-version=2025-01-01
{
"properties": {
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
}
import com.azure.resourcemanager.sql.fluent.models.ServerVulnerabilityAssessmentInner;
import com.azure.resourcemanager.sql.models.VulnerabilityAssessmentName;
/**
* Samples for ServerVulnerabilityAssessments CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json
*/
/**
* Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is
* specified.
*
* @param manager Entry point to SqlServerManager.
*/
public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified(
com.azure.resourcemanager.sql.SqlServerManager manager) {
manager.serviceClient().getServerVulnerabilityAssessments().createOrUpdateWithResponse(
"vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", VulnerabilityAssessmentName.DEFAULT,
new ServerVulnerabilityAssessmentInner()
.withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/")
.withStorageContainerSasKey("fakeTokenPlaceholder"),
com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python server_vulnerability_assessment_create_container_sas_key_min.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SqlManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.server_vulnerability_assessments.create_or_update(
resource_group_name="vulnerabilityaseessmenttest-4799",
server_name="vulnerabilityaseessmenttest-6440",
vulnerability_assessment_name="default",
parameters={
"properties": {
"storageContainerPath": "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
"storageContainerSasKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
}
},
)
print(response)
# x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SqlManagementClient } = require("@azure/arm-sql");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
*
* @summary creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity - https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage
* x-ms-original-file: 2025-01-01/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json
*/
async function createAServerVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified() {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.serverVulnerabilityAssessments.createOrUpdate(
"vulnerabilityaseessmenttest-4799",
"vulnerabilityaseessmenttest-6440",
"default",
{
storageContainerPath: "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
storageContainerSasKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
},
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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/SQL/stable/2025-01-01/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json
// this example is just showing the usage of "ServerVulnerabilityAssessments_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 SqlServerVulnerabilityAssessmentResource created on azure
// for more information of creating SqlServerVulnerabilityAssessmentResource, please refer to the document of SqlServerVulnerabilityAssessmentResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "vulnerabilityaseessmenttest-4799";
string serverName = "vulnerabilityaseessmenttest-6440";
VulnerabilityAssessmentName vulnerabilityAssessmentName = VulnerabilityAssessmentName.Default;
ResourceIdentifier sqlServerVulnerabilityAssessmentResourceId = SqlServerVulnerabilityAssessmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, vulnerabilityAssessmentName);
SqlServerVulnerabilityAssessmentResource sqlServerVulnerabilityAssessment = client.GetSqlServerVulnerabilityAssessmentResource(sqlServerVulnerabilityAssessmentResourceId);
// invoke the operation
SqlServerVulnerabilityAssessmentData data = new SqlServerVulnerabilityAssessmentData
{
StorageContainerPath = "https://myStorage.blob.core.windows.net/vulnerability-assessment/",
StorageContainerSasKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
};
ArmOperation<SqlServerVulnerabilityAssessmentResource> lro = await sqlServerVulnerabilityAssessment.UpdateAsync(WaitUntil.Completed, data);
SqlServerVulnerabilityAssessmentResource 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
SqlServerVulnerabilityAssessmentData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Beispiel für eine Antwort
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": false,
"emails": [],
"isEnabled": true
}
}
}
{
"name": "default",
"type": "Microsoft.Sql/servers/vulnerabilityAssessments",
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/vulnerabilityaseessmenttest-4799/providers/Microsoft.Sql/servers/vulnerabilityaseessmenttest-6440/vulnerabilityAssessments/default",
"properties": {
"recurringScans": {
"emailSubscriptionAdmins": false,
"emails": [],
"isEnabled": true
}
}
}
Definitionen
createdByType
Enumeration
Der Identitätstyp, der die Ressource erstellt hat.
| Wert |
Beschreibung |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
ErrorAdditionalInfo
Objekt
Der Ressourcenverwaltungsfehler zusätzliche Informationen.
| Name |
Typ |
Beschreibung |
|
info
|
object
|
Die zusätzlichen Informationen.
|
|
type
|
string
|
Der zusätzliche Informationstyp.
|
ErrorDetail
Objekt
Das Fehlerdetails.
| Name |
Typ |
Beschreibung |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
Die zusätzlichen Informationen des Fehlers.
|
|
code
|
string
|
Der Fehlercode.
|
|
details
|
ErrorDetail[]
|
Die Fehlerdetails.
|
|
message
|
string
|
Die Fehlermeldung.
|
|
target
|
string
|
Das Fehlerziel.
|
ErrorResponse
Objekt
Fehlerantwort
| Name |
Typ |
Beschreibung |
|
error
|
ErrorDetail
|
Das Fehlerobjekt.
|
ServerVulnerabilityAssessment
Objekt
Eine Server-Sicherheitsrisikobewertung.
| Name |
Typ |
Beschreibung |
|
id
|
string
(arm-id)
|
Vollqualifizierte Ressourcen-ID für die Ressource. Z. B. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
name
|
string
|
Der Name der Ressource
|
|
properties.recurringScans
|
VulnerabilityAssessmentRecurringScansProperties
|
Die Einstellungen für wiederkehrende Scans
|
|
properties.storageAccountAccessKey
|
string
|
Gibt den Bezeichnerschlüssel des Speicherkontos für Überprüfungsergebnisse der Sicherheitsrisikobewertung an. Wenn "StorageContainerSasKey" nicht angegeben ist, ist "storageAccountAccessKey" erforderlich. Gilt nur, wenn sich das Speicherkonto nicht hinter einem Vnet oder einer Firewall befindet.
|
|
properties.storageContainerPath
|
string
|
Ein Blobspeichercontainerpfad zum Speichern der Scanergebnisse (z. B. https://myStorage.blob.core.windows.net/VaScans/).
|
|
properties.storageContainerSasKey
|
string
|
Eine freigegebene Zugriffssignatur (SAS Key), die Schreibzugriff auf den blob-Container hat, der im Parameter "storageContainerPath" angegeben ist. Wenn "storageAccountAccessKey" nicht angegeben ist, ist StorageContainerSasKey erforderlich. Gilt nur, wenn sich das Speicherkonto nicht hinter einem Vnet oder einer Firewall befindet.
|
|
systemData
|
systemData
|
Azure Resource Manager-Metadaten, die createdBy und modifiedBy-Informationen enthalten.
|
|
type
|
string
|
Der Typ der Ressource. Zum Beispiel "Microsoft. Compute/virtualMachines" oder "Microsoft. Speicher/Speicherkonten"
|
systemData
Objekt
Metadaten zur Erstellung und letzten Änderung der Ressource.
| Name |
Typ |
Beschreibung |
|
createdAt
|
string
(date-time)
|
Der Zeitstempel der Ressourcenerstellung (UTC).
|
|
createdBy
|
string
|
Die Identität, die die Ressource erstellt hat.
|
|
createdByType
|
createdByType
|
Der Identitätstyp, der die Ressource erstellt hat.
|
|
lastModifiedAt
|
string
(date-time)
|
Der Zeitstempel der letzten Änderung der Ressource (UTC)
|
|
lastModifiedBy
|
string
|
Die Identität, die die Ressource zuletzt geändert hat.
|
|
lastModifiedByType
|
createdByType
|
Der Identitätstyp, der die Ressource zuletzt geändert hat.
|
VulnerabilityAssessmentName
Enumeration
Der Name der Sicherheitsrisikobewertung.
| Wert |
Beschreibung |
|
default
|
Standardwert
|
VulnerabilityAssessmentRecurringScansProperties
Objekt
Eigenschaften einer Wiederkehrenden Überprüfung der Sicherheitsrisikobewertung.
| Name |
Typ |
Standardwert |
Beschreibung |
|
emailSubscriptionAdmins
|
boolean
|
True
|
Gibt an, dass die Zeitplanscanbenachrichtigung an die Abonnementadministratoren gesendet wird.
|
|
emails
|
string[]
|
|
Gibt ein Array von E-Mail-Adressen an, an die die Scanbenachrichtigung gesendet wird.
|
|
isEnabled
|
boolean
|
|
Status der wiederkehrenden Scans.
|