在订阅上创建或更新所请求类型的服务器漏洞评估设置
PUT https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting?api-version=2023-05-01
URI 参数
请求正文
定义范围内的 Azure 服务器上的漏洞评估设置。
响应
安全性
azure_auth
Azure Active Directory OAuth2 Flow
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 |
说明 |
user_impersonation
|
模拟用户帐户
|
示例
Set a server vulnerability assessments setting of the kind settingKind on the subscription
示例请求
PUT https://management.azure.com/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting?api-version=2023-05-01
{
"kind": "AzureServersSetting",
"properties": {
"selectedProvider": "MdeTvm"
}
}
import com.azure.resourcemanager.security.models.AzureServersSetting;
import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsAzureSettingSelectedProvider;
import com.azure.resourcemanager.security.models.ServerVulnerabilityAssessmentsSettingKindName;
/**
* Samples for ServerVulnerabilityAssessmentsSettings CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/
* ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json
*/
/**
* Sample code: Set a server vulnerability assessments setting of the kind settingKind on the subscription.
*
* @param manager Entry point to SecurityManager.
*/
public static void setAServerVulnerabilityAssessmentsSettingOfTheKindSettingKindOnTheSubscription(
com.azure.resourcemanager.security.SecurityManager manager) {
manager.serverVulnerabilityAssessmentsSettings().createOrUpdateWithResponse(
ServerVulnerabilityAssessmentsSettingKindName.AZURE_SERVERS_SETTING, new AzureServersSetting()
.withSelectedProvider(ServerVulnerabilityAssessmentsAzureSettingSelectedProvider.MDE_TVM),
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
package armsecurity_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json
func ExampleServerVulnerabilityAssessmentsSettingsClient_CreateOrUpdate() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsecurity.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewServerVulnerabilityAssessmentsSettingsClient().CreateOrUpdate(ctx, armsecurity.ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting, &armsecurity.AzureServersSetting{
Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting),
Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{
SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm),
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armsecurity.ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse{
// ServerVulnerabilityAssessmentsSettingClassification: &armsecurity.AzureServersSetting{
// Name: to.Ptr("azureServersSetting"),
// Type: to.Ptr("Microsoft.Security/serverVulnerabilityAssessmentsSettings"),
// ID: to.Ptr("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting"),
// SystemData: &armsecurity.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-12T13:47:50.328Z"); return t}()),
// CreatedBy: to.Ptr("user@contoso.com"),
// CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-01-12T13:47:50.328Z"); return t}()),
// LastModifiedBy: to.Ptr("user@contoso.com"),
// LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser),
// },
// Kind: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsSettingKindAzureServersSetting),
// Properties: &armsecurity.ServerVulnerabilityAssessmentsAzureSettingProperties{
// SelectedProvider: to.Ptr(armsecurity.ServerVulnerabilityAssessmentsAzureSettingSelectedProviderMdeTvm),
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SecurityCenter } = require("@azure/arm-security");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Create or update a server vulnerability assessments setting of the requested kind on the subscription
*
* @summary Create or update a server vulnerability assessments setting of the requested kind on the subscription
* x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json
*/
async function setAServerVulnerabilityAssessmentsSettingOfTheKindSettingKindOnTheSubscription() {
const subscriptionId =
process.env["SECURITY_SUBSCRIPTION_ID"] || "20ff7fc3-e762-44dd-bd96-b71116dcdc23";
const settingKind = "azureServersSetting";
const serverVulnerabilityAssessmentsSetting = {
kind: "AzureServersSetting",
selectedProvider: "MdeTvm",
};
const credential = new DefaultAzureCredential();
const client = new SecurityCenter(credential, subscriptionId);
const result = await client.serverVulnerabilityAssessmentsSettings.createOrUpdate(
settingKind,
serverVulnerabilityAssessmentsSetting,
);
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 System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.SecurityCenter;
using Azure.ResourceManager.SecurityCenter.Models;
// Generated from example definition: specification/security/resource-manager/Microsoft.Security/stable/2023-05-01/examples/ServerVulnerabilityAssessmentsSettings/PutServerVulnerabilityAssessmentsSetting_example.json
// this example is just showing the usage of "ServerVulnerabilityAssessmentsSettings_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 ServerVulnerabilityAssessmentsSettingResource created on azure
// for more information of creating ServerVulnerabilityAssessmentsSettingResource, please refer to the document of ServerVulnerabilityAssessmentsSettingResource
string subscriptionId = "20ff7fc3-e762-44dd-bd96-b71116dcdc23";
ServerVulnerabilityAssessmentsSettingKindName settingKind = ServerVulnerabilityAssessmentsSettingKindName.AzureServersSetting;
ResourceIdentifier serverVulnerabilityAssessmentsSettingResourceId = ServerVulnerabilityAssessmentsSettingResource.CreateResourceIdentifier(subscriptionId, settingKind);
ServerVulnerabilityAssessmentsSettingResource serverVulnerabilityAssessmentsSetting = client.GetServerVulnerabilityAssessmentsSettingResource(serverVulnerabilityAssessmentsSettingResourceId);
// invoke the operation
ServerVulnerabilityAssessmentsSettingData data = new AzureServersSetting()
{
SelectedProvider = ServerVulnerabilityAssessmentsAzureSettingSelectedProvider.MdeTvm,
};
ArmOperation<ServerVulnerabilityAssessmentsSettingResource> lro = await serverVulnerabilityAssessmentsSetting.UpdateAsync(WaitUntil.Completed, data);
ServerVulnerabilityAssessmentsSettingResource 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
ServerVulnerabilityAssessmentsSettingData 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
示例响应
{
"id": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting",
"name": "azureServersSetting",
"type": "Microsoft.Security/serverVulnerabilityAssessmentsSettings",
"kind": "AzureServersSetting",
"properties": {
"selectedProvider": "MdeTvm"
},
"systemData": {
"createdBy": "user@contoso.com",
"createdByType": "User",
"createdAt": "2022-01-12T13:47:50.328Z",
"lastModifiedBy": "user@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2022-01-12T13:47:50.328Z"
}
}
{
"id": "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/azureServersSetting",
"name": "azureServersSetting",
"type": "Microsoft.Security/serverVulnerabilityAssessmentsSettings",
"kind": "AzureServersSetting",
"properties": {
"selectedProvider": "MdeTvm"
},
"systemData": {
"createdBy": "user@contoso.com",
"createdByType": "User",
"createdAt": "2023-05-12T13:47:50.328Z",
"lastModifiedBy": "user@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2023-05-12T13:47:50.328Z"
}
}
定义
定义范围内的 Azure 服务器上的漏洞评估设置。
名称 |
类型 |
说明 |
id
|
string
|
资源的完全限定资源 ID。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”
|
kind
|
string:
AzureServersSetting
|
服务器漏洞评估设置的类型。
|
name
|
string
|
资源的名称
|
properties.selectedProvider
|
ServerVulnerabilityAssessmentsAzureSettingSelectedProvider
|
定义的范围内的 Azure 服务器上的所选漏洞评估提供程序。
|
systemData
|
systemData
|
包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。
|
type
|
string
|
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”
|
createdByType
创建资源的标识的类型。
名称 |
类型 |
说明 |
Application
|
string
|
|
Key
|
string
|
|
ManagedIdentity
|
string
|
|
User
|
string
|
|
ErrorAdditionalInfo
资源管理错误附加信息。
名称 |
类型 |
说明 |
info
|
object
|
其他信息。
|
type
|
string
|
其他信息类型。
|
ErrorDetail
错误详细信息。
ErrorResponse
错误响应
ServerVulnerabilityAssessmentsAzureSettingSelectedProvider
定义的范围内的 Azure 服务器上的所选漏洞评估提供程序。
名称 |
类型 |
说明 |
MdeTvm
|
string
|
Microsoft Defender for Endpoints 威胁和漏洞管理。
|
ServerVulnerabilityAssessmentsSettingKind
服务器漏洞评估设置的类型
名称 |
类型 |
说明 |
AzureServersSetting
|
string
|
|
ServerVulnerabilityAssessmentsSettingKindName
服务器漏洞评估设置的类型
名称 |
类型 |
说明 |
azureServersSetting
|
string
|
|
systemData
与创建和上次修改资源相关的元数据。
名称 |
类型 |
说明 |
createdAt
|
string
|
资源创建时间戳(UTC)。
|
createdBy
|
string
|
创建资源的标识。
|
createdByType
|
createdByType
|
创建资源的标识的类型。
|
lastModifiedAt
|
string
|
上次修改的资源时间戳(UTC)
|
lastModifiedBy
|
string
|
上次修改资源的标识。
|
lastModifiedByType
|
createdByType
|
上次修改资源的标识的类型。
|