我将配置创建的Azure虚拟机(例如,安装角色,初始化新的硬盘磁盘等)。我看到天蓝色的ARM中有一个新功能Microsoft.Resources / deploymentScripts。根据我在订阅中创建的Managed Identity的文档,为Subscription级别的新创建的Managed Identity授予Contributor权限。然后我使用Microsoft.Resources / deploymentScripts功能在ARM模板下进行了开发。下面粘贴的代码。我想将此代码粘贴到用于VM部署的ARM模板中。问题是我是否能够使用此方法来执行以下脚本:在OS级别上安装角色,例如IIS或WSUS,配置HDD等...
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
"type": "string",
"defaultValue": "'John Dole'"
},
"utcValue": {
"type": "string",
"defaultValue": "[utcNow()]"
}
},
"resources": [
{
"type": "Microsoft.Resources/deploymentScripts",
"apiVersion": "2019-10-01-preview",
"name": "runPowerShellInlineWithOutput",
"location": "westeurope",
"kind": "AzurePowerShell",
"identity": {
"type": "userAssigned",
"userAssignedIdentities": {
"/subscriptions/SubID/resourceGroups/RGname/providers/Microsoft.ManagedIdentity/userAssignedIdentities/MI-ARMdeployment": {}
}
},
"properties": {
"forceUpdateTag": "[parameters('utcValue')]",
"azPowerShellVersion": "3.0",
"scriptContent": "
$output = 'hello'
Write-Output $output",
"arguments": "",
"timeout": "PT1H",
"cleanupPreference": "OnSuccess",
"retentionInterval": "P1D"
}
}
]
}
嗯,是的(有一些技巧),但这并不意味着。它用于配置\配置Azure级别的资源,而不是VM内部的内容。
您具有DSC extension和script extension(两个Windows \ Linux都可用。)>