1

作为标题,我删除了 VMAccessForLinux 扩展。但是,没有办法取回扩展名。

如何在我的虚拟机上重新安装扩展?

在使用 Azure CLI 的情况下,它会出现如下错误:


2016 年 2 月 24 日星期三 20:56:17 GMT+0900 (KST):{ [错误:对角色的扩展参考更新无效:Look360VM 和参考:VMAccessForLinux。] 代码:'BadRequest',statusCode:400,requestId:'36d5f8a1bcd37ce480e26e31a2742249'错误:角色的扩展参考更新无效:Look360VM 和参考:VMAccessForLinux。在 Function.ServiceClient._normalizeError (/usr/local/azure/node_modules/azure-common/lib/services/serviceclient.js:815:23) 在 /usr/local/azure/node_modules/azure-common/lib/services/过滤器/errorhandlingfilter.js:44:29 在 Request._callback (/usr/local/azure/node_modules/azure-common/lib/http/request-pipeline.js:109:14) 在 Request.self.callback (/usr /local/azure/node_modules/azure-common/node_modules/request/request.js:199:22) 在 Request.emit (events.js:110:17) 在请求。(/usr/local/azure/node_modules/azure-common/node_modules/request/request.js:1160:14) 在 IncomingMessage 的 Request.emit (events.js:129:20)。(/usr/local/azure/node_modules/azure-common/node_modules/request/request.js:1111:12) 在 IncomingMessage.emit (events.js:129:20) 在 _stream_readable.js:908:16


它说'BadRequest'。我不知道究竟是为什么,但可能是我删除了扩展名。

如果您有经验,请评论解决方案。谢谢。

4

3 回答 3

2

In the current Azure CLI, always use the utility command azure vm reset-access and its parameters to perform this work, assuming you're on ARM deployment. It's simply the easiest way to do this, since you do not have to worry about json stuff....

azure vm reset-access --help
help:    Enables you to reset Remote Desktop Access or SSH settings on a Virtual Machine and to reset the password for the account that has administrator or sudo authority.
help:
help:    Usage: vm reset-access [options] <resource-group> <name>
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -g, --resource-group <resource-group>  the resource group name
help:      -n, --name <name>                      the virtual machine name
help:      -u, --user-name <user-name>            the user name
help:      -p, --password <password>              the password
help:      -M, --ssh-key-file <ssh-key-file>      path to public key PEM file or SSH Public key file for SSH authentication (valid only when os-type is "Linux")
help:      -r, --reset-ssh                        Reset the SSH configuration to default
help:      -E, --extension-version <version>      Version of VM Access extension [1.4]
help:      -e, --expiration <expiration>          password expiration
help:      -R, --remove-user <remove-user-name>   Remove a user account with specified name
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)
于 2016-03-06T20:47:01.970 回答
1

在使用 Azure CLI 将扩展安装到我的 VM 时,我得到了确切的错误。我还没有确定根本原因。但是,我有另一种安装扩展的方法,即使用 Azure PowerShell。

这是命令:

$vm = Get-AzureVm -ServiceName <your cloud service> -Name <your vm>

Set-AzureVMExtension -ExtensionName "VMAccessForLinux" -VM $vm `
    -Publisher "Microsoft.OSTCExtensions" -Version "1.*" | Update-AzureVM




经过几次挖掘,我找到了根本原因。您需要为“VMAccessForLinux”指定“参考名称”,即“Microsoft.OSTCExtensions.VMAccessForLinux”。对于azure vm extension set,默认情况下,它使用扩展名作为引用名,适用于大多数扩展名。但是,“VMAccessForLinux”并非如此。

这是命令:

azure vm extension set "<your VM>" "VMAccessForLinux" "Microsoft.OSTCExtensions" "1.*" -r "Microsoft.OSTCExtensions.VMAccessForLinux"
于 2016-03-01T04:18:09.233 回答
0

发布答案以启用新的资源管理器虚拟机:

$RGName = "<Rg name>"
$VmName = "<Vm name>"
$Location = '<VM Location>'

$ExtensionName = 'VMAccessForLinux'
$Publisher = 'Microsoft.OSTCExtensions'
$Version = '1.4'

$PublicConf = '{}'
$PrivateConf = '{
  "username": "<new username>",
  "password": "<new password>",
  "reset_ssh": true
}'

Set-AzureRmVMExtension -ResourceGroupName $RGName -VMName $VmName -Location $Location -Name $ExtensionName -Publisher $Publisher -ExtensionType $ExtensionName -TypeHandlerVersion $Version -Settingstring $PublicConf -ProtectedSettingString $PrivateConf

有关更多详细信息,请参阅https://github.com/Azure/azure-linux-extensions/tree/master/VMAccess

于 2016-06-07T14:46:29.577 回答