How to deploy Azure Linux VM and configure it from my local jenkin pipeline?

asked 2020-09-01T17:52:16.207+00:00
Amit P 1 Reputation point

I am using bitbucket as my repository, and jenkin is running on my local linux box .Jenin server is configure with bitbucket repository.
I want to deploy linux VM using azure cli using jenkin pipeline ?
I am aware how to deploy manually using azure cli but via jenkin pipeline I am confuse?

Regards,
Amit

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
4,552 questions
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2020-09-02T07:43:29.917+00:00
    prmanhas-MSFT 17,506 Reputation points Microsoft Employee

    @Amit P You have to use service principal to login to Azure using Az CLI and execute commands.

    Service principals are accounts not tied to any particular user, which can have permissions on them assigned through pre-defined roles. Authenticating with a service principal is the best way to write secure scripts or programs, allowing you to apply both permissions restrictions and locally stored static credential information. To learn more about service principals you can refer this.

    A Jenkins plugin enables you to use Azure CLI for managing Azure resources.

    The advantage of this plugin that it let's you export the CLI result from each command to environment variables and to the next command.

    You can refer to this for more information around the setup part.

    This article might be helpful as well to understand how to Add Azure service principal to a Jenkins credential.

    Hope it helps!!!

    Do let me know in case of any more queries.

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics.

    Note : There are few articles in the mentioned answer which are not the official documentation from Microsoft side, so we can't confirm on the working of components as mentioned in the article.We have just tried to provide you the information which can be helpful to you with the current issue you are facing and help you in resolving the same.

    Thanks

    No comments