Search code examples
azurejenkinsjenkins-pipelinejenkins-pluginsazure-virtual-machine

Unable to Provision Azure VM From Jenkins After Setting up Cloud


I'm currently trying to setup Jenkins to provision Azure virtual machines (or container instances) to run integration tests. After following the instructions on the VM plugin, I'm not sure how exactly I can get Jenkins to provision an Azure VM from a Jenkins pipeline. While the plugin claims that it'll provision automatically, I think there's something else I'm missing. Finding information on how to do this correctly is a bit scarce.

If there's any additional information needed, my project is running in Python and need to use MSSQL. The project is also being applied against a Github Organization project.


Solution

  • When you follow the docs to provision the Azure VM agent, then you need to check if the VM agent is already created.

    Manage Jenkins -> Manage Nodes and clouds:

    enter image description here

    And when you create the Item, it will allow you to select the nodes:

    enter image description here

    Here you can choose the label that you set for the Azure VM agent. Then the project will run on the Azure VM agent. Here is the artcile in Azure.