0

I'm trying to create a Azure VM in Java with the Azure SDK and I want to use the following image but I get the following error:

Error message: 'Offer with PublisherId: 'bitnami' and OfferId: 'wordpress' not found

    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();

1 Answers1

0

According to my test, when we initialize PurchasePlan class, we need to use the image sku as the plan name.

For exmaple

 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

Jim Xu
  • 21,610
  • 2
  • 19
  • 39
  • If it is useful for you, could you please [accept it as an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)? – Jim Xu Aug 26 '20 at 01:55