【问题标题】:Cannot install IIS on the azure virtual machines无法在 Azure 虚拟机上安装 IIS
【发布时间】:2021-12-13 11:53:26
【问题描述】:

按照教程https://docs.microsoft.com/en-us/azure/application-gateway/create-ssl-portal(使用免费试用作为订阅)我总是因为错误而失败

ErrorCode: AuthorizationFailed
ErrorMessage:  The client '<mai e-mail address>' with object id'xxx' does not have authorization to perform action 'Microsoft.Compute/virtualMachines/extensions/write' over scope '/subscriptions/yyy/resourceGroups/myResourceGroupAG/providers/Microsoft.Compute/virtualMachines/myVM/extensions/IIS' or the scope is invalid. If access was recently granted, please refresh your credentials.
ErrorTarget:
StatusCode: 403
ReasonPhrase: Forbidden
OperationID : zzz

运行命令时

Set-AzVMExtension `>>   -ResourceGroupName myResourceGroupAG `
>>   -ExtensionName IIS `
>>   -VMName myVM `
>>   -Publisher Microsoft.Compute `
>>   -ExtensionType CustomScriptExtension `
>>   -TypeHandlerVersion 1.4 `
>>   -SettingString '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}' `
>>   -Location 'West US 2'

根据门户访问控制我(图中的JM)应该有角色Virtual machine Contributor,但是没有帮助。

【问题讨论】:

  • RDP 到 VM 并启用 IIS 使用 windows 功能
  • @Aatif Akhter “RDP 到 VM”是什么意思?
  • @RahulKumarShaw-MT 明白了你的意思,但我现在无法测试它,因为我的免费试用版已经过时,正在使用 log4j 修复程序......
  • 您好@Jaana,因为这对我有用。您可以投票并接受它作为答案(单击答案旁边的复选标记,将其从灰色切换为填充。) .这对其他社区成员可能是有益的。谢谢

标签: azure azure-vm


【解决方案1】:

我尝试使用相同的 PowerShell 脚本命令,它非常适合我。

您可以尝试运行Disconnect-AzAccountClear-AzContext作为解决方案,以便删除所有用户的上下文,然后您可以再次通过Connect-Azaccount从powershell登录到azure。

订阅级别的所有者访问权限足以执行您尝试执行的操作,不需要单独授予虚拟机参与者角色。

要解决此问题,您可以手动安装 IIS 服务器。

第 1 步:登录您的虚拟机。

第 2 步:管理->添加角色和功能

第 3 步:选择 Webserver IIS -> 下一步->安装

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-02
    • 2015-09-04
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 2020-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多