如何解决Azure 虚拟机规模集上的自定义数据
需要在 azure 虚拟机规模集 (Windows) 中自定义数据来安装 IIS 服务器并替换默认的 iis 页面回显服务器的主机名。感谢这方面的任何指导,
解决方法
根据您的要求,我想在您的虚拟机规模集上推荐 Azure 自定义脚本扩展。
Here 是官方示例。这将安装 IIS Web 服务器并输出规模集 VM 实例的主机名。自定义脚本扩展定义从 GitHub 下载示例脚本,安装所需的包,然后将虚拟机实例主机名写入基本 HTML 页面。
$customConfig = @{
"fileUris" = (,"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/automate-iis.ps1");
"commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File automate-iis.ps1"
}
# Get information about the scale set
$vmss = Get-AzVmss `
-ResourceGroupName "myResourceGroup" `
-VMScaleSetName "myScaleSet"
# Add the Custom Script Extension to install IIS and configure basic website
$vmss = Add-AzVmssExtension `
-VirtualMachineScaleSet $vmss `
-Name "customScript" `
-Publisher "Microsoft.Compute" `
-Type "CustomScriptExtension" `
-TypeHandlerVersion 1.9 `
-Setting $customConfig
# Update the scale set and apply the Custom Script Extension to the VM instances
Update-AzVmss `
-ResourceGroupName "myResourceGroup" `
-Name "myScaleSet" `
-VirtualMachineScaleSet $vmss
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。