gpt4 book ai didi

Azure ARM - Microsoft.Resources/deploymentScripts

转载 作者:行者123 更新时间:2023-12-03 05:37:54 24 4
gpt4 key购买 nike

我将配置创建的azure VM(例如,安装角色、初始化新硬盘等)。我看到azure ARM中有一个新功能Microsoft.Resources/deploymentScripts。根据文档,我在订阅中创建了托管身份,在订阅上向新创建的托管身份授予贡献者权限等级。然后我使用 Microsoft.Resources/deploymentScripts 功能开发了以下 ARM 模板。代码粘贴在下面。我想将此代码粘贴到我的 ARM 模板中以进行虚拟机部署。问题是我是否能够使用这种方法来执行脚本,例如:在操作系统级别安装角色,如 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 extensionscript extension为此(适用于 Windows\Linux)。

关于Azure ARM - Microsoft.Resources/deploymentScripts,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61077920/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com