이 문서에서는 ARM 템플릿(Azure Resource Manager 템플릿)을 사용하여 Azure Arc 지원 서버에 VM(가상 머신) 확장을 배포하는 방법을 보여 줍니다.
ARM 템플릿을 사용하여 Arc 지원 서버에 확장을 배포하려면 템플릿에 확장을 추가하고 템플릿 배포를 사용하여 실행합니다. Azure PowerShell을 사용하여 Linux 또는 Windows 연결된 머신에 확장을 배포할 수 있습니다.
이 문서에서는 템플릿 파일과 일부 확장에 대한 별도의 매개 변수 파일을 사용하여 Arc 지원 서버에 여러 다른 VM 확장을 배포하는 방법을 보여 줍니다. 배포하기 전에 샘플의 예제 값을 사용자 고유의 값으로 바꿉다.
배포 명령
이러한 샘플 PowerShell 명령은 ARM 템플릿의 정보를 기반으로 리소스 그룹 내의 모든 연결된 컴퓨터에 확장을 설치합니다. 이 명령은 매개 변수를 TemplateFile 사용하여 템플릿을 지정합니다. 매개 변수 파일이 필요한 TemplateParameterFile 경우 매개 변수 및 매개 변수 값이 포함된 파일을 지정하기 위해 매개 변수가 포함됩니다. 자리 표시자를 배포에 적절한 값으로 바꿉다.
ARM 템플릿 및 매개 변수 파일을 배포하려면 다음 명령을 사용하여 예제 값을 사용자 고유의 값으로 대체합니다.
New-AzResourceGroupDeployment -ResourceGroupName "<resource-group-name>" -TemplateFile "<template-filename.json>" -TemplateParameterFile "<parameter-filename.json>"
다음은 그 예입니다.
New-AzResourceGroupDeployment -ResourceGroupName "ContosoEngineering" -TemplateFile "D:\Azure\Templates\AzureMonitorAgent.json" -TemplateParameterFile "D:\Azure\Templates\AzureMonitorAgentParms.json"
매개 변수 파일 없이 ARM 템플릿을 배포하려면 다음 명령을 사용하여 예제 값을 사용자 고유의 값으로 대체합니다.
New-AzResourceGroupDeployment -ResourceGroupName "<resource-group-name>" -TemplateFile "<template-filename.json>>"
다음은 그 예입니다.
New-AzResourceGroupDeployment -ResourceGroupName "<ContosoEngineering>" -TemplateFile "D:\Azure\Templates\DependencyAgent.json"
Azure Monitor 에이전트 VM 확장 배포
Azure Monitor 에이전트를 배포하려면 다음 샘플 템플릿 중 하나를 사용하여 Linux 또는 Windows에 에이전트를 설치합니다.
Linux용 Azure Monitor 에이전트 템플릿 파일
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"workspaceKey": {
"type": "string"
}
},
"resources": [
{
"name": "[concat(parameters('vmName'),'/AzureMonitorLinuxAgent')]",
"type": "Microsoft.Compute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2021-11-01",
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorLinuxAgent",
"enableAutomaticUpgrade": true,
"settings": {
"workspaceId": "[parameters('workspaceId')]"
},
"protectedSettings": {
"workspaceKey": "[parameters('workspaceKey')]"
}
}
}
]
}
Windows용 Azure Monitor 에이전트 템플릿 파일
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"workspaceKey": {
"type": "string"
}
},
"resources": [
{
"name": "[concat(parameters('vmName'),'/AzureMonitorWindowsAgent')]",
"type": "Microsoft.Compute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2021-11-01",
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorWindowsAgent",
"autoUpgradeMinorVersion": true,
"enableAutomaticUpgrade": true,
"settings": {
"workspaceId": "[parameters('workspaceId')]"
},
"protectedSettings": {
"workspaceKey": "[parameters('workspaceKey')]"
}
}
}
]
}
Azure Monitor 에이전트 매개 변수 파일
이 매개 변수 파일은 Linux 및 Windows 모두에 사용할 수 있습니다.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"value": "<vmName>"
},
"location": {
"value": "<region>"
},
"workspaceId": {
"value": "<MyWorkspaceID>"
},
"workspaceKey": {
"value": "<MyWorkspaceKey>"
}
}
}
템플릿 및 매개 변수 파일을 저장하고 배포에 적절한 값을 사용하여 매개 변수 파일을 편집합니다. 그런 다음, 이 문서의 앞부분에서 찾은 PowerShell 배포 명령을 실행하여 연결된 컴퓨터에 Azure Monitor 에이전트 확장을 설치합니다.
사용자 지정 스크립트 확장 배포
사용자 지정 스크립트 확장을 사용하려면 Linux 및 Windows용 다음 샘플 템플릿 중 하나를 배포합니다. 사용자 지정 스크립트 확장에 대한 자세한 내용은 Linux용 사용자 지정 스크립트 확장 또는 Windows용 사용자 지정 스크립트 확장을 참조하세요. 하이브리드 머신에서 이 확장을 사용할 때 이해해야 하는 몇 가지 다른 특성이 있습니다.
- Azure VM 사용자 지정 스크립트 확장을 사용하는 지원되는 운영 체제 목록은 Azure Arc 지원 서버에 적용되지 않습니다. Azure Arc 지원 서버에 대해 지원되는 운영 체제 목록을 참조하세요.
- 클래식 배포 모델을 통해 만든 Azure 가상 머신 확장 집합 또는 VM에 대한 구성 세부 정보는 적용되지 않습니다.
- 컴퓨터가 외부에서 스크립트를 다운로드해야 하고 프록시 서버를 통해서만 통신할 수 있는 경우 프록시 서버의 환경 변수를 설정하도록 Connected Machine 에이전트 를 구성해야 합니다.
사용자 지정 스크립트 확장 구성은 스크립트 위치 및 실행할 명령 등을 지정합니다. 이 구성은 다음 템플릿에 지정됩니다.
Linux용 사용자 지정 스크립트 확장 템플릿 파일
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"fileUris": {
"type": "array"
},
"commandToExecute": {
"type": "securestring"
}
},
"resources": [
{
"name": "[concat(parameters('vmName'),'/CustomScript')]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2022-03-10",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"autoUpgradeMinorVersion": true,
"settings": {},
"protectedSettings": {
"commandToExecute": "[parameters('commandToExecute')]",
"fileUris": "[parameters('fileUris')]"
}
}
}
]
}
Windows용 사용자 지정 스크립트 템플릿 파일
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"fileUris": {
"type": "string"
},
"arguments": {
"type": "securestring",
"defaultValue": " "
}
},
"variables": {
"UriFileNamePieces": "[split(parameters('fileUris'), '/')]",
"firstFileNameString": "[variables('UriFileNamePieces')[sub(length(variables('UriFileNamePieces')), 1)]]",
"firstFileNameBreakString": "[split(variables('firstFileNameString'), '?')]",
"firstFileName": "[variables('firstFileNameBreakString')[0]]"
},
"resources": [
{
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
"type": "Microsoft.HybridCompute/machines/extensions",
"location": "[parameters('location')]",
"apiVersion": "2022-03-10",
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": "[split(parameters('fileUris'), ' ')]"
},
"protectedSettings": {
"commandToExecute": "[concat ('powershell -ExecutionPolicy Unrestricted -File ', variables('firstFileName'), ' ', parameters('arguments'))]"
}
}
}
]
}
사용자 지정 스크립트 매개 변수 파일
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"basics": [
{}
],
"steps": [
{
"name": "customScriptExt",
"label": "Add Custom Script Extension",
"elements": [
{
"name": "fileUris",
"type": "Microsoft.Common.FileUpload",
"label": "Script files",
"toolTip": "The script files that will be downloaded to the virtual machine.",
"constraints": {
"required": false
},
"options": {
"multiple": true,
"uploadMode": "url"
},
"visible": true
},
{
"name": "commandToExecute",
"type": "Microsoft.Common.TextBox",
"label": "Command",
"defaultValue": "sh script.sh",
"toolTip": "The command to execute, for example: sh script.sh",
"constraints": {
"required": true
},
"visible": true
}
]
}
],
"outputs": {
"vmName": "[vmName()]",
"location": "[location()]",
"fileUris": "[steps('customScriptExt').fileUris]",
"commandToExecute": "[steps('customScriptExt').commandToExecute]"
}
}
}
템플릿 및 매개 변수 파일을 저장하고 배포에 적절한 값을 사용하여 매개 변수 파일을 편집합니다. 그런 다음, 이 문서의 앞부분에서 찾은 PowerShell 배포 명령을 실행하여 연결된 컴퓨터에 사용자 지정 스크립트 확장을 설치합니다.
종속성 에이전트 확장 배포
Azure Monitor 종속성 에이전트 확장을 사용하려면 Linux 및 Windows에 대해 다음 샘플 중 하나를 실행합니다. 종속성 에이전트에 대한 자세한 내용은 Azure Monitor 에이전트 개요를 참조하세요.
Linux용 종속성 에이전트 템플릿 파일
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "The name of existing Linux machine."
}
}
},
"resources": [
{
"type": "Microsoft.HybridCompute/machines/extensions",
"name": "[concat(parameters('vmName'),'/DAExtension')]",
"apiVersion": "2022-03-10",
"location": "[resourceGroup().location]",
"dependsOn": [
],
"properties": {
"publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
"type": "DependencyAgentLinux",
"enableAutomaticUpgrade": true
}
}
],
"outputs": {
}
}
Windows용 종속성 에이전트 템플릿 파일
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "The name of existing Windows machine."
}
}
},
"resources": [
{
"type": "Microsoft.HybridCompute/machines/extensions",
"name": "[concat(parameters('vmName'),'/DAExtension')]",
"apiVersion": "2022-03-10",
"location": "[resourceGroup().location]",
"dependsOn": [
],
"properties": {
"publisher": "Microsoft.Azure.Monitoring.DependencyAgent",
"type": "DependencyAgentWindows",
"enableAutomaticUpgrade": true
}
}
],
"outputs": {
}
}
템플릿을 저장한 다음, 이 문서의 앞부분에서 찾은 PowerShell 배포 명령을 실행하여 연결된 컴퓨터에 종속성 에이전트 확장을 설치합니다.
Azure Key Vault 확장 배포
다음 JSON은 Azure Key Vault 확장에 대한 스키마를 보여 줍니다. 모든 설정은 공개 정보로 간주되므로 이 확장에는 보호된 설정이 필요하지 않습니다. 확장에는 모니터링되는 인증서 목록, 폴링 빈도 및 대상 인증서 저장소가 필요합니다.
Linux용 Azure Key Vault 템플릿 파일
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"autoUpgradeMinorVersion":{
"type": "bool"
},
"pollingIntervalInS":{
"type": "int"
},
"certificateStoreName":{
"type": "string"
},
"certificateStoreLocation":{
"type": "string"
},
"observedCertificates":{
"type": "string"
},
"msiEndpoint":{
"type": "string"
},
"msiClientId":{
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.HybridCompute/machines/extensions",
"name": "[concat(parameters('vmName'),'/KVVMExtensionForLinux')]",
"apiVersion": "2022-03-10",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Azure.KeyVault",
"type": "KeyVaultForLinux",
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettings": {
"pollingIntervalInS": <polling interval in seconds, e.g. "3600">,
"certificateStoreName": <ignored on linux>,
"certificateStoreLocation": <disk path where certificate is stored, default: "/var/lib/waagent/Microsoft.Azure.KeyVault">,
"observedCertificates": <list of KeyVault URIs representing monitored certificates, e.g.: "https://myvault.vault.azure.net/secrets/mycertificate"
},
"authenticationSettings": {
"msiEndpoint": "http://localhost:40342/metadata/identity"
}
}
}
}
]
}
Windows용 Azure Key Vault 템플릿 파일
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "string"
},
"location": {
"type": "string"
},
"autoUpgradeMinorVersion":{
"type": "bool"
},
"pollingIntervalInS":{
"type": "int"
},
"certificateStoreName":{
"type": "string"
},
"linkOnRenewal":{
"type": "bool"
},
"certificateStoreLocation":{
"type": "string"
},
"requireInitialSync":{
"type": "bool"
},
"observedCertificates":{
"type": "string"
},
"msiEndpoint":{
"type": "string"
},
"msiClientId":{
"type": "string"
}
},
"resources": [
{
"type": "Microsoft.HybridCompute/machines/extensions",
"name": "[concat(parameters('vmName'),'/KVVMExtensionForWindows')]",
"apiVersion": "2022-03-10",
"location": "[parameters('location')]",
"properties": {
"publisher": "Microsoft.Azure.KeyVault",
"type": "KeyVaultForWindows",
"enableAutomaticUpgrade": true,
"settings": {
"secretsManagementSettings": {
"pollingIntervalInS": "3600",
"certificateStoreName": <certificate store name, e.g.: "MY">,
"linkOnRenewal": <Only Windows. This feature ensures s-channel binding when certificate renews, without necessitating a re-deployment. e.g.: false>,
"certificateStoreLocation": <certificate store location, currently it works locally only e.g.: "LocalMachine">,
"requireInitialSync": <initial synchronization of certificates e.g.: true>,
"observedCertificates": <list of KeyVault URIs representing monitored certificates, e.g.: "https://myvault.vault.azure.net"
},
"authenticationSettings": {
"msiEndpoint": "http://localhost:40342/metadata/identity"
}
}
}
}
]
}
참고 항목
관찰된 인증서 URL은 형식 https://myVaultName.vault.azure.net/secrets/myCertName이어야 합니다. 그 이유는 경로가 /secrets 프라이빗 키를 포함하여 전체 인증서를 반환하는 반면 경로는 반환하지 않기 때문 /certificates 입니다. 인증서에 대한 자세한 내용은 Azure Key Vault 키, 비밀 및 인증서 개요를 참조하세요.
템플릿을 저장하고 필요에 따라 편집합니다. 그런 다음, 이 문서의 앞부분에서 찾은 PowerShell 배포 명령을 실행하여 연결된 컴퓨터에 Azure Key Vault 확장을 설치합니다.
팁 (조언)
Azure Key Vault 확장을 사용하려면 Key Vault에 인증하기 위해 시스템 할당 ID를 할당해야 합니다. 자세한 내용은 Azure Arc 지원 서버를 사용하여 Azure 리소스에 대해 인증을 참조하세요.
관련 콘텐츠
- Azure Arc 지원 서버에서 지원하는 VM 확장에 대해 자세히 알아보세요.
- Azure PowerShell, AzurePortal 또는 Azure CLI를 사용하여 VM 확장을 배포, 관리 및 제거하는 방법을 알아봅니다.
- VM 확장 문제 해결 가이드에서 문제 해결 정보를 살펴봅니다.