虚拟主机管理器和 Azure

您可以使用虚拟主机管理器 (VHM) 收集 Microsoft Azure 中的实例。

VHM 允许 SUSE Multi-Linux Manager 获取和报告有关您的虚拟机的信息。 有关 VHM 的详细信息,请参见 虚拟主机管理器

1. 先决条件

要让您创建的 VHM 访问 Azure VM,需要为其指派正确的权限。

以订阅管理员身份登录到您的 Azure 帐户,并确保 Azure 用户帐户和应用程序在正确的组中。 应用程序所在的组决定了它的角色,因此也决定了权限。

2. 创建 Azure VHM

虚拟主机管理器 (VHM) 在 SUSE Multi-Linux Manager 服务器上运行。

确保您已在 SUSE Multi-Linux Manager 服务器上安装了 virtual-host-gatherer-libcloud 软件包。

过程:升级创建 Azure VHM
  1. 在 SUSE Multi-Linux Manager Web UI 中,导航到 系统  虚拟主机管理器

  2. 单击 创建 并从下拉菜单中选择 Azure

  3. Add an Azure Virtual Host Manager 部分中,使用以下参数:

    • Label 字段中,为您的 VHM 输入自定义名称。

    • Subscription ID 字段中,键入在 Azure portal > Services > Subscriptions 页面中找到的订阅 ID。

    • Application ID 字段中,键入您在注册应用程序时获得的应用程序 ID。

    • Tenant ID 字段中,键入您在注册应用程序时获得的、由 Azure 提供的租户 ID。

    • Secret Key 字段中,键入与 Azure 实例关联的机密密钥。

    • Zone 字段中,输入您的 VM 所在的可用区。例如,对于西欧,请输入 westeurope。 要使订阅匹配功能正常工作,就必须提供此信息。

  4. 单击 创建 以保存更改并创建 VHM。

  5. Virtual Host Managers 页面中,选择新 VHM。

  6. Properties 页面中,单击 刷新数据 以清点新 VHM。

要查看已清点的对象和资源,请导航到 系统  系统列表  虚拟系统

3. 指派权限

如果未正确设置权限,您在运行 virtual-host-gatherer 时可能会收到如下所示的错误:

General error: [AuthorizationFailed] The client 'client_name' with object id 'object_ID' does not have authorization to perform action 'Microsoft.Compute/virtualMachines/read' over scope '/subscriptions/not-very-secret-subscription-id' or the scope is invalid. If access was recently granted, please refresh your credentials.

要确定正确的身份凭证,请在 SUSE Multi-Linux Manager 服务器上的提示符处运行以下命令:

virtual-host-gatherer -i input_azure.json -o out_azure.json -vvv

input_azure.json 文件应包含以下信息:

[
    {
        "id": "azure_vhm",
        "module": "Azure",
        "subscription_id": "subscription-id",
        "application_id": "application-id",
        "tenant_id": "tenant-id",
        "secret_key": "secret-key",
        "zone": "zone"
    }
]

4. Azure UUID

在 Azure 公有云上运行的实例会向 SUSE Multi-Linux Manager 服务器报告如下 UUID:

13f56399-bd52-4150-9748-7190aae1ff21