使用Azure Windows VM运行PowerSell脚本的自定义数据
我试图在Azure云中设置Windows VM期间下载并安装exe。我不想使用自定义脚本扩展,而是想使用“自定义数据”。我在Azure文档中找不到任何可靠的示例 在AWS中,我找到了足够的资源,我可以开发下面的PowerShell脚本并将其添加到用户数据中,但这在Azure上不起作用,我尝试了不同的变体,但没有成功。以前有人这样做过吗?有没有关于这方面的明确文件?我读到Azure使用Cloud init,但同样地,对于如何在Windows机器上使用Cloud init,没有明确的示例,所有示例都是针对Linux的使用Azure Windows VM运行PowerSell脚本的自定义数据,azure,powershell,Azure,Powershell,我试图在Azure云中设置Windows VM期间下载并安装exe。我不想使用自定义脚本扩展,而是想使用“自定义数据”。我在Azure文档中找不到任何可靠的示例 在AWS中,我找到了足够的资源,我可以开发下面的PowerShell脚本并将其添加到用户数据中,但这在Azure上不起作用,我尝试了不同的变体,但没有成功。以前有人这样做过吗?有没有关于这方面的明确文件?我读到Azure使用Cloud init,但同样地,对于如何在Windows机器上使用Cloud init,没有明确的示例,所有示例都
<powershell>
start-transcript
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest 'https://www.domain-name.com/filename.exe' -OutFile C:\filename.exe
C:\filename.exe --quiet
</powershell>
开始记录
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12
$ProgressPreference='SilentlyContinue'
调用WebRequest'https://www.domain-name.com/filename.exe'-OutFile C:\filename.exe
C:\filename.exe--安静
任何帮助都将不胜感激。您可以将数据注入Azure上的Windows虚拟机,但不能使用自定义数据或cloud init强制执行。只有Ubuntu映像支持使用cloud init执行自定义数据 资料来源: 要在设置后执行脚本,这取决于您如何设置VM
az vm run命令执行脚本,如下所示:
来源于此处:感谢您的帮助,这就是为什么我可能找不到它,因为它不存在。我正在尝试实现相同的目标,但稍作更改,我只想使用AWS s3中的自定义数据运行一个简单的powershell脚本。任何帮助都将非常有用
az vm run-command invoke --command-id RunPowerShellScript --name win-vm -g my-resource-group \
--scripts 'param([string]$arg1)' \
'Write-Host Hello' \
--parameters 'arg1=kemety'