Microsoft。維護配置 2025-10-01-preview

Bicep 資源定義

configurationAssignments 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

部署維護指派的基本範例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'
@secure()
@description('The administrator password for the virtual machine')
param adminPassword string

resource virtualMachine 'Microsoft.Compute/virtualMachines@2023-03-01' = {
  name: resourceName
  location: location
  properties: {
    additionalCapabilities: {}
    applicationProfile: {
      galleryApplications: []
    }
    diagnosticsProfile: {
      bootDiagnostics: {
        enabled: false
        storageUri: ''
      }
    }
    extensionsTimeBudget: 'PT1H30M'
    hardwareProfile: {
      vmSize: 'Standard_F2'
    }
    networkProfile: {
      networkInterfaces: [
        {
          id: networkInterface.id
          properties: {
            primary: true
          }
        }
      ]
    }
    osProfile: {
      adminPassword: adminPassword
      adminUsername: 'adminuser'
      allowExtensionOperations: true
      computerName: resourceName
      linuxConfiguration: {
        disablePasswordAuthentication: false
        patchSettings: {
          assessmentMode: 'ImageDefault'
          patchMode: 'ImageDefault'
        }
        provisionVMAgent: true
        ssh: {
          publicKeys: []
        }
      }
      secrets: []
    }
    priority: 'Regular'
    storageProfile: {
      dataDisks: []
      imageReference: {
        offer: 'UbuntuServer'
        publisher: 'Canonical'
        sku: '16.04-LTS'
        version: 'latest'
      }
      osDisk: {
        caching: 'ReadWrite'
        createOption: 'FromImage'
        managedDisk: {
          storageAccountType: 'Standard_LRS'
        }
        osType: 'Linux'
        writeAcceleratorEnabled: false
      }
    }
  }
}

resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-07-01' = {
  name: resourceName
  location: location
  properties: {
    addressSpace: {
      addressPrefixes: [
        '10.0.0.0/16'
      ]
    }
    dhcpOptions: {
      dnsServers: []
    }
    subnets: []
  }
}

resource subnet 'Microsoft.Network/virtualNetworks/subnets@2022-07-01' = {
  name: 'internal'
  parent: virtualNetwork
  properties: {
    addressPrefix: '10.0.2.0/24'
    delegations: []
    privateEndpointNetworkPolicies: 'Enabled'
    privateLinkServiceNetworkPolicies: 'Enabled'
    serviceEndpointPolicies: []
    serviceEndpoints: []
  }
}

resource configurationAssignment 'Microsoft.Maintenance/configurationAssignments@2022-07-01-preview' = {
  name: resourceName
  scope: virtualMachine
  properties: {
    maintenanceConfigurationId: maintenanceConfiguration.id
    resourceId: virtualMachine.id
  }
}

resource maintenanceConfiguration 'Microsoft.Maintenance/maintenanceConfigurations@2022-07-01-preview' = {
  name: resourceName
  location: location
  properties: {
    extensionProperties: {}
    maintenanceScope: 'SQLDB'
    namespace: 'Microsoft.Maintenance'
    visibility: 'Custom'
  }
}

resource networkInterface 'Microsoft.Network/networkInterfaces@2022-07-01' = {
  name: resourceName
  location: location
  properties: {
    enableAcceleratedNetworking: false
    enableIPForwarding: false
    ipConfigurations: [
      {
        name: 'testconfiguration1'
        properties: {
          primary: true
          privateIPAddressVersion: 'IPv4'
          privateIPAllocationMethod: 'Dynamic'
          subnet: {
            id: subnet.id
          }
        }
      }
    ]
  }
}

Azure 已驗證的模組

以下的 Azure 已驗證模組 可用於部署此資源類型。

模組 Description
維護設定指派 維護設定指派的AVM資源模組

資源格式

若要建立 Microsoft.Maintenance/configurationAssignments 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.Maintenance/configurationAssignments@2025-10-01-preview' = {
  scope: resourceSymbolicName or scope
  location: 'string'
  name: 'string'
  properties: {
    filter: {
      locations: [
        'string'
      ]
      osTypes: [
        'string'
      ]
      resourceGroups: [
        'string'
      ]
      resourceTypes: [
        'string'
      ]
      tagSettings: {
        filterOperator: 'string'
        tags: {
          {customized property}: [
            'string'
          ]
        }
      }
    }
    maintenanceConfigurationId: 'string'
    resourceId: 'string'
  }
}

屬性值

Microsoft.Maintenance/configurationAssignments

名稱 Description 價值
位置 資源的位置 字串
名字 資源名稱 字串 (必要)
properties 組態指派的屬性 ConfigurationAssignmentProperties
範圍 在與部署範圍不同的範圍內建立資源時,請使用 。 將此屬性設為資源的符號名稱,以套用 extension resource。

ConfigurationAssignmentFilterProperties

名稱 Description 價值
locations 要設定查詢範圍的位置清單。 string[]
os類型 允許的作業系統清單。 string[]
resourceGroups 允許的資源群組清單。 string[]
resourceTypes 允許的資源清單。 string[]
標籤設置 VM 的標記設定。 TagSettingsProperties

ConfigurationAssignmentProperties

名稱 Description 價值
篩選 組態指派的屬性 ConfigurationAssignmentFilterProperties
maintenanceConfigurationId 維護組態標識碼 字串
resourceId unique resourceId 字串

TagSettingsProperties

名稱 Description 價值
filter運算符 依 [任何] 或 [所有] 指定的標籤篩選 VM。 'All'
'任何'
tags 標記的字典及其值清單。 TagSettingsProperties標籤

TagSettingsProperties標籤

名稱 Description 價值

ARM 樣本資源定義

configurationAssignments 資源類型可以使用目標作業來部署:

使用範例

資源格式

若要建立 Microsoft.Maintenance/configurationAssignments 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.Maintenance/configurationAssignments",
  "apiVersion": "2025-10-01-preview",
  "name": "string",
  "location": "string",
  "properties": {
    "filter": {
      "locations": [ "string" ],
      "osTypes": [ "string" ],
      "resourceGroups": [ "string" ],
      "resourceTypes": [ "string" ],
      "tagSettings": {
        "filterOperator": "string",
        "tags": {
          "{customized property}": [ "string" ]
        }
      }
    },
    "maintenanceConfigurationId": "string",
    "resourceId": "string"
  }
}

屬性值

Microsoft.Maintenance/configurationAssignments

名稱 Description 價值
apiVersion API 版本 “2025-10-01-預覽”
位置 資源的位置 字串
名字 資源名稱 字串 (必要)
properties 組態指派的屬性 ConfigurationAssignmentProperties
型別 資源類型 “Microsoft.Maintenance/configurationAssignments”

ConfigurationAssignmentFilterProperties

名稱 Description 價值
locations 要設定查詢範圍的位置清單。 string[]
os類型 允許的作業系統清單。 string[]
resourceGroups 允許的資源群組清單。 string[]
resourceTypes 允許的資源清單。 string[]
標籤設置 VM 的標記設定。 TagSettingsProperties

ConfigurationAssignmentProperties

名稱 Description 價值
篩選 組態指派的屬性 ConfigurationAssignmentFilterProperties
maintenanceConfigurationId 維護組態標識碼 字串
resourceId unique resourceId 字串

TagSettingsProperties

名稱 Description 價值
filter運算符 依 [任何] 或 [所有] 指定的標籤篩選 VM。 'All'
'任何'
tags 標記的字典及其值清單。 TagSettingsProperties標籤

TagSettingsProperties標籤

名稱 Description 價值

Terraform (AzAPI 提供者) 資源定義

configurationAssignments 資源類型可以使用目標作業來部署:

  • 訂閱* 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署維護指派的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

variable "admin_password" {
  type        = string
  description = "The administrator password for the virtual machine"
  sensitive   = true
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "maintenanceConfiguration" {
  type      = "Microsoft.Maintenance/maintenanceConfigurations@2022-07-01-preview"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      extensionProperties = {
      }
      maintenanceScope = "SQLDB"
      namespace        = "Microsoft.Maintenance"
      visibility       = "Custom"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualNetwork" {
  type      = "Microsoft.Network/virtualNetworks@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      addressSpace = {
        addressPrefixes = [
          "10.0.0.0/16",
        ]
      }
      dhcpOptions = {
        dnsServers = [
        ]
      }
      subnets = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
  lifecycle {
    ignore_changes = [body.properties.subnets]
  }
}

resource "azapi_resource" "subnet" {
  type      = "Microsoft.Network/virtualNetworks/subnets@2022-07-01"
  parent_id = azapi_resource.virtualNetwork.id
  name      = "internal"
  body = {
    properties = {
      addressPrefix = "10.0.2.0/24"
      delegations = [
      ]
      privateEndpointNetworkPolicies    = "Enabled"
      privateLinkServiceNetworkPolicies = "Enabled"
      serviceEndpointPolicies = [
      ]
      serviceEndpoints = [
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "networkInterface" {
  type      = "Microsoft.Network/networkInterfaces@2022-07-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      enableAcceleratedNetworking = false
      enableIPForwarding          = false
      ipConfigurations = [
        {
          name = "testconfiguration1"
          properties = {
            primary                   = true
            privateIPAddressVersion   = "IPv4"
            privateIPAllocationMethod = "Dynamic"
            subnet = {
              id = azapi_resource.subnet.id
            }
          }
        },
      ]
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "virtualMachine" {
  type      = "Microsoft.Compute/virtualMachines@2023-03-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
      additionalCapabilities = {
      }
      applicationProfile = {
        galleryApplications = [
        ]
      }
      diagnosticsProfile = {
        bootDiagnostics = {
          enabled    = false
          storageUri = ""
        }
      }
      extensionsTimeBudget = "PT1H30M"
      hardwareProfile = {
        vmSize = "Standard_F2"
      }
      networkProfile = {
        networkInterfaces = [
          {
            id = azapi_resource.networkInterface.id
            properties = {
              primary = true
            }
          },
        ]
      }
      osProfile = {
        adminPassword            = var.admin_password
        adminUsername            = "adminuser"
        allowExtensionOperations = true
        computerName             = var.resource_name
        linuxConfiguration = {
          disablePasswordAuthentication = false
          patchSettings = {
            assessmentMode = "ImageDefault"
            patchMode      = "ImageDefault"
          }
          provisionVMAgent = true
          ssh = {
            publicKeys = [
            ]
          }
        }
        secrets = [
        ]
      }
      priority = "Regular"
      storageProfile = {
        dataDisks = [
        ]
        imageReference = {
          offer     = "UbuntuServer"
          publisher = "Canonical"
          sku       = "16.04-LTS"
          version   = "latest"
        }
        osDisk = {
          caching      = "ReadWrite"
          createOption = "FromImage"
          managedDisk = {
            storageAccountType = "Standard_LRS"
          }
          osType                  = "Linux"
          writeAcceleratorEnabled = false
        }
      }
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

resource "azapi_resource" "configurationAssignment" {
  type      = "Microsoft.Maintenance/configurationAssignments@2022-07-01-preview"
  parent_id = azapi_resource.virtualMachine.id
  name      = var.resource_name
  body = {
    location = "westeurope"
    properties = {
      maintenanceConfigurationId = azapi_resource.maintenanceConfiguration.id
      resourceId                 = azapi_resource.virtualMachine.id
    }
  }
  ignore_casing             = true
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

資源格式

若要建立 Microsoft.Maintenance/configurationAssignments 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Maintenance/configurationAssignments@2025-10-01-preview"
  name = "string"
  parent_id = "string"
  location = "string"
  body = {
    properties = {
      filter = {
        locations = [
          "string"
        ]
        osTypes = [
          "string"
        ]
        resourceGroups = [
          "string"
        ]
        resourceTypes = [
          "string"
        ]
        tagSettings = {
          filterOperator = "string"
          tags = {
            {customized property} = [
              "string"
            ]
          }
        }
      }
      maintenanceConfigurationId = "string"
      resourceId = "string"
    }
  }
}

屬性值

Microsoft.Maintenance/configurationAssignments

名稱 Description 價值
位置 資源的位置 字串
名字 資源名稱 字串 (必要)
parent_id 要套用此延伸模組資源之資源的標識碼。 字串 (必要)
properties 組態指派的屬性 ConfigurationAssignmentProperties
型別 資源類型 「Microsoft。維護/configurationAssignments@2025-10-01-預覽”

ConfigurationAssignmentFilterProperties

名稱 Description 價值
locations 要設定查詢範圍的位置清單。 string[]
os類型 允許的作業系統清單。 string[]
resourceGroups 允許的資源群組清單。 string[]
resourceTypes 允許的資源清單。 string[]
標籤設置 VM 的標記設定。 TagSettingsProperties

ConfigurationAssignmentProperties

名稱 Description 價值
篩選 組態指派的屬性 ConfigurationAssignmentFilterProperties
maintenanceConfigurationId 維護組態標識碼 字串
resourceId unique resourceId 字串

TagSettingsProperties

名稱 Description 價值
filter運算符 依 [任何] 或 [所有] 指定的標籤篩選 VM。 'All'
'任何'
tags 標記的字典及其值清單。 TagSettingsProperties標籤

TagSettingsProperties標籤

名稱 Description 價值