Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

Objective

You have a working Azure Python docker function and the source code is managed in a Git repository.  The goal of the tutorial is to automate the build and publish of a docker image to Azure Function App. This automation will include:

...

The tutorial does not cover every feature or configuration option available in FlexDeploy.

Checklist

Checklist

Description

Azure Tenant Id

Azure Tenant Id for the company

Azure Subscription Id

Azure Subscription where the Function App exists

Azure Client ID

Client ID to connect to desired Azure Subscription

Azure Client Key

Password for the Client ID

Azure Client ID permission

The Client ID must have relevant access in the target Function App to deploy code

Azure Function App

The Function App with relevant runtime should already be created

Azure Resource Group

The Resource Group containing the Function App

Azure CLI installation

Azure CLI needs to be installed on the Target m/c where the plugin operation shall run

Azure CLI in class path

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

Docker Registry Address

Target Azure Container Registry URL

Docker Registry User

Azure Client ID to push/pull images against Azure Container Registry

Docker Registry Token/Password

Password for the above Client ID

Docker Registry User permission

The Client ID must have relevant access to push/pull images from Azure Container Registry

Configure cloud account

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

...

  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

...

Configure container account

Next, a DockerRegistry account needs to be configured under Topology. FlexDeploy will connect to the right Container Registry with provided details and push the docker image.

...

  1. Docker Registry Token/Password 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 the codebase. A dockerfile should exist within the codebase with steps defined to create the docker image. Alongside it can also contain any Application Setting and Connection String related attributes in respective files(any naming convention allowed). These files are not mandatory, however, in case someone has any Application Setting and Connection String property to update this is recommended option. Please review Application Setting and Connection String property update for detailed explanation.

...

Application Setting and Connection String JSON files(if applicable/present) will be moved to the intermediate directory. An intermediate directory can have any name, in this case, we are using the artifactsObjects folder inside the TEMP directory. File names are mentioned under File Filter with ‘##’ separated (as advised in the description). Application Setting and Connection String values can also be passed as input to deploy workflow. Application Setting and Connection String files are optional, please review the Application Setting and Connection String property update for a detailed explanation.

...

Step-iii: Build note: Its essential to make sure Consumes Artifacts and Produces Artifacts checkbox is marked only when required. Please follow the snapshots for all execution steps to avoid any discrepancy.  

Step-iii: Build and Push docker image to ACR

...

If the Container Registry Account is properly configured it would push the image to Docker Registry. In our case, the image will be pushed to Azure Container Registry.

...

Step-iv: Save all as Artifact from the intermediate dir as Artifact 

Post execution of the above steps the intermediate directory(artifactObjects) should contain files as shown below.

...

Anchor
Source_Control
Source_Control
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 SOURCES for configuring the Source Repository

  4. Select the appropriate Source Control Type

  5. Configure Source Repository. For detailed steps of Source Control configuration please refer to Configure Source Control in FlexDeploy

Project Properties

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

...

Application Setting and Connection String values will be updated against the Function Slot Name configured at the environment level. Refer to the Deploy to slot section for further detailsat the environment level. Refer to the Deploy to slot section for further details.

There could also be scenarios where someone only need to update the Application Setting or Connection String without actually deploying the code. In that case one can use upsertFunctionApplicationSetting or upsertFunctionConnectionString operations respectively. The workflow execution will be exactly same only the code archive creation /Docker image update step will not be required. Build workflow generated artifact should only container AppSetting.json or ConnString.json. These values can also be passed as input as already mentioned in detail in above section.

Target Properties

Select Topology from the menu and then select Topology Overview from the left menu. You will see a table that has Instances as the rows and Environments as the columns with colored circles representing the Environment Instance. Color coding represents:

...

Properties

Mandatory field

Description

Slot Name

 

Target slot for deployment

Target slot to swap

Optional

In case slot swap is required

Azure Cloud Account

 

An azure account with relevant details

The absolute path of Azure CLI

Optional

Not required if Azure CLI already added to workflow execution m/c classpath

Docker Server

Optional

Docker server address. Required if Docker Unix Socket is not set.

Docker Server Port

Optional

The port to connect to on the Docker server.

Docker Unix Socket

Optional

The socket the Docker daemon listens on

The default value is [/var/run/docker.sock]

Registry Account

Docker Registry account with relevant details

GIT Path

Optional

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

Below given are the env-specific values which need to be updated.

...

Congratulations! You have successfully completed the Java Application Python docker image deployment to the Azure Function App tutorial.

...