Bagikan melalui


Ekstensi konfigurasi komputer Azure Automanage

Ekstensi konfigurasi komputer adalah fitur Azure Automanage yang melakukan operasi audit dan konfigurasi di dalam komputer virtual (VM).

Untuk memeriksa kebijakan di dalam VM, seperti definisi garis besar keamanan komputasi Azure untuk Linux dan Windows, ekstensi konfigurasi komputer harus diinstal.

Prasyarat

Untuk mengaktifkan VM Anda untuk mengautentikasi ke layanan konfigurasi komputer, VM Anda harus memiliki identitas terkelola yang ditetapkan sistem. Anda dapat memenuhi persyaratan identitas untuk VM Anda dengan mengatur "type": "SystemAssigned" properti :

"identity": {
   "type": "SystemAssigned"
}

Sistem operasi

Dukungan sistem operasi untuk ekstensi konfigurasi komputer sama dengan dukungan sistem operasi yang didokumen untuk solusi end-to-end.

Konektivitas internet

Agen yang diinstal oleh ekstensi konfigurasi komputer harus dapat menjangkau paket konten yang tercantum oleh penetapan konfigurasi tamu, dan melaporkan status ke layanan konfigurasi komputer. VM dapat terhubung dengan menggunakan HTTPS keluar melalui port TCP 443, atau koneksi yang disediakan melalui jaringan privat.

Untuk mempelajari selengkapnya tentang jaringan privat, lihat artikel berikut ini:

Menginstal ekstensi

Anda dapat menginstal dan menyebarkan ekstensi konfigurasi komputer langsung dari Azure CLI atau PowerShell. Templat penyebaran juga tersedia untuk Azure Resource Manager (ARM), Bicep, dan Terraform. Untuk detail templat penyebaran, lihat Microsoft.GuestConfiguration guestConfigurationAssignments.

Catatan

Dalam contoh penyebaran berikut, ganti <placeholder> nilai parameter dengan nilai tertentu untuk konfigurasi Anda.

Pertimbangan penyebaran

Sebelum Anda menginstal dan menyebarkan ekstensi konfigurasi komputer, tinjau pertimbangan berikut.

  • Nama instans. Saat Anda menginstal ekstensi konfigurasi komputer, nama instans ekstensi harus diatur ke AzurePolicyforWindows atau AzurePolicyforLinux. Kebijakan definisi garis besar keamanan yang dijelaskan sebelumnya memerlukan string khusus ini.

  • Versi. Secara default, semua penyebaran diperbarui ke versi terbaru. Nilai autoUpgradeMinorVersion properti default ke true kecuali ditentukan lain. Fitur ini membantu meringankan kekhawatiran tentang memperbarui kode Anda saat versi baru ekstensi konfigurasi komputer dirilis.

  • Peningkatan otomatis. Ekstensi konfigurasi komputer mendukung enableAutomaticUpgrade properti . Ketika properti ini diatur ke true, Azure secara otomatis meningkatkan ke versi terbaru ekstensi saat rilis mendatang tersedia. Untuk informasi selengkapnya, lihat Peningkatan Ekstensi Otomatis untuk VM dan Virtual Machine Scale Sets di Azure.

  • Azure Policy. Untuk menyebarkan versi terbaru ekstensi konfigurasi komputer dalam skala besar termasuk persyaratan identitas, ikuti langkah-langkah dalam Membuat penetapan kebijakan untuk mengidentifikasi sumber daya yang tidak patuh. Buat penugasan berikut dengan Azure Policy:

  • Properti lainnya. Anda tidak perlu menyertakan pengaturan atau properti pengaturan yang dilindungi pada ekstensi konfigurasi komputer. Agen mengambil kelas informasi ini dari sumber daya penetapan Konfigurasi Tamu Azure REST API. Misalnya, ConfigurationUriproperti , Mode, dan ConfigurationSetting masing-masing dikelola per konfigurasi daripada pada ekstensi VM.

Azure CLI

Untuk menerapkan ekstensi untuk Linux:

az vm extension set  --publisher Microsoft.GuestConfiguration --name ConfigurationForLinux --extension-instance-name AzurePolicyforLinux --resource-group <myResourceGroup> --vm-name <myVM> --enable-auto-upgrade true

Untuk menyebarkan ekstensi untuk Windows:

az vm extension set  --publisher Microsoft.GuestConfiguration --name ConfigurationforWindows --extension-instance-name AzurePolicyforWindows --resource-group <myResourceGroup> --vm-name <myVM> --enable-auto-upgrade true

PowerShell

Untuk menerapkan ekstensi untuk Linux:

Set-AzVMExtension -Publisher 'Microsoft.GuestConfiguration' -ExtensionType 'ConfigurationForLinux' -Name 'AzurePolicyforLinux' -TypeHandlerVersion 1.0 -ResourceGroupName '<myResourceGroup>' -Location '<myLocation>' -VMName '<myVM>' -EnableAutomaticUpgrade $true

Untuk menyebarkan ekstensi untuk Windows:

Set-AzVMExtension -Publisher 'Microsoft.GuestConfiguration' -ExtensionType 'ConfigurationforWindows' -Name 'AzurePolicyforWindows' -TypeHandlerVersion 1.0 -ResourceGroupName '<myResourceGroup>' -Location '<myLocation>' -VMName '<myVM>' -EnableAutomaticUpgrade $true

Templat ARM

Untuk menerapkan ekstensi untuk Linux:

{
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(parameters('VMName'), '/AzurePolicyforLinux')]",
  "apiVersion": "2020-12-01",
  "location": "[parameters('location')]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', parameters('VMName'))]"
  ],
  "properties": {
    "publisher": "Microsoft.GuestConfiguration",
    "type": "ConfigurationForLinux",
    "typeHandlerVersion": "1.0",
    "autoUpgradeMinorVersion": true,
    "enableAutomaticUpgrade": true, 
    "settings": {},
    "protectedSettings": {}
  }
}

Untuk menyebarkan ekstensi untuk Windows:

{
  "type": "Microsoft.Compute/virtualMachines/extensions",
  "name": "[concat(parameters('VMName'), '/AzurePolicyforWindows')]",
  "apiVersion": "2020-12-01",
  "location": "[parameters('location')]",
  "dependsOn": [
    "[concat('Microsoft.Compute/virtualMachines/', parameters('VMName'))]"
  ],
  "properties": {
    "publisher": "Microsoft.GuestConfiguration",
    "type": "ConfigurationforWindows",
    "typeHandlerVersion": "1.0",
    "autoUpgradeMinorVersion": true,
    "enableAutomaticUpgrade": true, 
    "settings": {},
    "protectedSettings": {}
  }
}

Templat Bicep

Untuk menerapkan ekstensi untuk Linux:

resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' existing = {
  name: 'VMName'
}
resource windowsVMGuestConfigExtension 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = {
  parent: virtualMachine
  name: 'AzurePolicyforLinux'
  location: resourceGroup().location
  properties: {
    publisher: 'Microsoft.GuestConfiguration'
    type: 'ConfigurationForLinux'
    typeHandlerVersion: '1.0'
    autoUpgradeMinorVersion: true
    enableAutomaticUpgrade: true
    settings: {}
    protectedSettings: {}
  }
}

Untuk menyebarkan ekstensi untuk Windows:

resource virtualMachine 'Microsoft.Compute/virtualMachines@2021-03-01' existing = {
  name: 'VMName'
}
resource windowsVMGuestConfigExtension 'Microsoft.Compute/virtualMachines/extensions@2020-12-01' = {
  parent: virtualMachine
  name: 'AzurePolicyforWindows'
  location: resourceGroup().location
  properties: {
    publisher: 'Microsoft.GuestConfiguration'
    type: 'ConfigurationforWindows'
    typeHandlerVersion: '1.0'
    autoUpgradeMinorVersion: true
    enableAutomaticUpgrade: true
    settings: {}
    protectedSettings: {}
  }
}

Templat Terraform

Untuk menerapkan ekstensi untuk Linux:

resource "azurerm_virtual_machine_extension" "gc" {
  name                       = "AzurePolicyforLinux"
  virtual_machine_id         = "<myVMID>"
  publisher                  = "Microsoft.GuestConfiguration"
  type                       = "ConfigurationForLinux"
  type_handler_version       = "1.0"
  auto_upgrade_minor_version = "true"
}

Untuk menyebarkan ekstensi untuk Windows:

resource "azurerm_virtual_machine_extension" "gc" {
  name                       = "AzurePolicyforWindows"
  virtual_machine_id         = "<myVMID>"
  publisher                  = "Microsoft.GuestConfiguration"
  type                       = "ConfigurationforWindows"
  type_handler_version       = "1.0"
  auto_upgrade_minor_version = "true"
}

Pesan kesalahan

Tabel berikut ini mencantumkan kemungkinan pesan kesalahan yang terkait dengan mengaktifkan ekstensi Konfigurasi Tamu.

Kode kesalahan Deskripsi
NoComplianceReport VM belum melaporkan data kepatuhan.
GCExtensionMissing Ekstensi konfigurasi komputer (konfigurasi tamu) hilang.
ManagedIdentityMissing Identitas terkelola hilang.
UserIdentityMissing Identitas yang ditetapkan pengguna hilang.
GCExtensionManagedIdentityMissing Ekstensi konfigurasi komputer (konfigurasi tamu) dan identitas terkelola hilang.
GCExtensionUserIdentityMissing Ekstensi konfigurasi komputer (konfigurasi tamu) dan identitas yang ditetapkan pengguna hilang.
GCExtensionIdentityMissing Ekstensi konfigurasi komputer (konfigurasi tamu), identitas terkelola, dan identitas yang ditetapkan pengguna hilang.

Langkah berikutnya