Azure Plugin - Execute Command/Script

Objective

You have a shell script in a Git repository. The goal of the tutorial is to execute the shell script.

This process will include:

  • Copy the shell script from a Git repository

  • Execute the shell script

We will walk through each of the FlexDeploy features that will be created/configured to accomplish this goal and Execute the shell script

Checklist

Checklist

Description

Checklist

Description

Azure Tenant Id

Azure Tenant Id for the company

Azure Subscription Id

Azure Subscription where the Web App exists

Azure Client ID

Client ID to connect to desired Azure Subscription

Azure Client Key

Password for the Client ID

Azure CLI installation

Azure CLI needs to be installed on the Target where the plugin operation shall run.

Please see https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=dnf for information on installing the azure-cli package.

Azure CLI in class path

Azure CLI should be added to the classpath in target. Else the path can also be set under FlexDeploy environment level property

Azure PowerShell

Azure PowerShell needs to be installed on Windows OS and path should be added to the classpath in target. Please refer to https://learn.microsoft.com/en-us/powershell/azure/install-azps-windows?view=azps-10.0.0&tabs=powershell&pivots=windows-psgallery

Configure cloud account

First, an Azure account needs to be configured under Topology. FlexDeploy will connect to the right Azure Subscription with provided details and do the execution.

  1. Navigate to the Integrations from the left-hand pane

  2. Navigate to the Cloud tab under Topology

  3. Navigate Create a new Cloud account of provider type “Azure” with the “+” button.

It should have a Client ID, Client Key, Tenant Id, and Subscription Id configured in it.

  1. Client Key is a password field and hence needs to be kept hidden. To update the same click on the pencil icon as shown below

  2. next update the Client Key value under Secret Text. This is to make sure no one else can retrieve the password

Git repository structure

The Git repository should contain shell script to execute.

The Sample Git repository structure is given below:

Build Workflow

Navigate to Workflows and create a build workflow using the button as highlighted below.

Below is a sample build workflow to copy and execute the script.

 Step-i: Clone Git Repository

This step will clone the Git repository codebase into the project execution working directory. The Git URL will be retrieved from Source Control configured under Project Configuration.

Step-ii: Copy the script file

The below step will copy the script file.

Step-iiI: execute the script file

Code Snippet field is mandatory, we can select the type of CLI from the drop-down. Available options are shell, PowerShell, and WindowsShell. The default CLI type is shell.

Project Configuration

Project Detail

Navigate to the Project tab and create a Project with a logical name(Azure-Command in this case)

Configure the Build workflow that has been created in previous steps as shown below.

Source Control

Configure the Source SCM repository under Source Control as shown below.

  1. To configure Project specific Source Control one first need to navigate to the Project Configuration tab.

  2. Next, expand the SOURCE CONTROL option from the left-hand pane.

  3. Select the appropriate Source Control Type

  4. Configure Source Repository. For detailed steps of Source Control configuration please refer to

Project Properties

To configure Project specific settings one can navigate to Configuration Properties as shown below.

  1. To configure Project specific settings one can navigate to the Project Configuration tab as shown above.

  2. Next, select the PROPERTIES option from the left-hand pane.

  3. Select the target Azure Cloud Account.

Target Properties

Topology

Navigate to the Topology from the Menu. The Page with the Target Groups, Environments and Endpoints sections will be displayed. Choose a Target Group on the left. You will see a list of Environments on the right with colored circles representing each Target

Properties

Mandatory field

Description

AZUREACCOUNT

Optional

Azure cloud account name

Azure CLI

Optional

Directory Where Azure CLI is installed

GIT Path

Optional

Path to the Git executable. Required only if git is not on PATH.

Build Execution

For detailed steps on how to initiate Build please refer to

Congratulations! You have successfully completed the tutorial.

Now that you have configured FlexDeploy to execute the script, it is extremely easy to replicate the same for other cloud provider as well. Simply use the Copy Project feature and a new project will be created with all of the configuration completed already. You just need to make the necessary configuration changes.

The following macros are not currently supported in the footer:
  • style