错误消息:找不到与PublisherId:'bitnami'和OfferId:'wordpress'的报价

问题描述

我正在尝试使用Azure SDK在Java中创建Azure VM,但我想使用以下image,但出现以下错误:

错误消息:“ Offer with PublisherId:“ bitnami”和OfferId: 找不到“ wordpress”

    PurchasePlan purchasePlan = new PurchasePlan()
            .withName("default")
            .withProduct("wordpress")
            .withPublisher("Bitnami");

    VirtualMachine virtualMachine = azure.virtualMachines()
            .define("another")
            .withRegion(Region.FRANCE_CENTRAL)
            .withExistingResourceGroup(resourceGroup)
            .withExistingPrimaryNetworkInterface(networkInterface)
            .withLatestLinuxImage("bitnami","wordpress","4-4")
            .withRootUsername("azureuser")
            .withRootPassword("Azure12345678")
            .withComputerName("myVM")
            .withPlan(purchasePlan)
            .withExistingAvailabilitySet(availabilitySet)
            .withSize("Standard_B1ls")
            .create();

解决方法

根据我的测试,当我们初始化PurchasePlan类时,我们需要使用图像sku作为计划名称。

例如

 PurchasePlan purchasePlan = new PurchasePlan()
                        .withName("4-4")
                        .withProduct("wordpress")
                        .withPublisher("bitnami");
        VirtualMachine vm = azure.virtualMachines()
                .define("test123")
                .withRegion(Region.FRANCE_CENTRAL)
                .withExistingResourceGroup("testword")
                .withExistingPrimaryNetworkInterface(nic)
                .withLatestLinuxImage("bitnami","wordpress","4-4")
                .withRootUsername("azureuser")
                .withRootPassword("Azure12345678")
                .withComputerName("myVM1")
                .withPlan(purchasePlan)
                .withExistingAvailabilitySet(availabilitySet)
                .withSize("Standard_B1ls")
                .create();

        System.out.println(vm.id());

enter image description here

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...