0

Based on most of the tutorials, it is suggested to add the FunctionAppName, Region, AppServicePlan in the pom.xml file. I will have to deploy this function app to various environments set up(different resource groups). I'd want to give the flexibility to the dev-ops team to add/edit this information before deploying the function app to the respective environment. Is there a way I can pass this value separately without hardcoding them in my pom.xml?

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/java-function?view=azure-devops

Jasmine
  • 135
  • 3
  • 16

1 Answers1

0

If we need to add the parameters dynamically in pom.xml file. We need to add a dynamic property in a Pom.xml file.

<project>
. . .
    <build>
    . . .
         <plugins>
            . . .
                <plugin>
                        <groupId>com.microsoft.azure</groupId>
                        <artifactId>azure-functions-maven-plugin</artifactId>
                        <version>${azure.functions.maven.plugin.version}</version>
                        <configuration>
                                <!-- function app name -->
                                <appName>${functionAppName}</appName>
                                <!-- function app resource group -->
                                <resourceGroup>>${Resourcegroup}</resourceGroup>
                                <!-- function app service plan name -->
                                <appServicePlanName>>${AppServiceName}</appServicePlanName>
                                . . .
                        </configuration>
                </plugin>
          </plugins>
    </build>
</project>

Edit your _pom.xml_ file update the settings:

Open your _pom.xml_ in the Cloud Shell code editor.

code pom.xml

Locate the following artifact ID:

<artifactId>azure-functions-maven-plugin</artifactId>

In the following <configuration> section, locate the <resourceGroup> element, and update it with the name of your resource group. For example:

<resourceGroup>[resource group name]</resourceGroup>

Locate the <region> element, and update it with the name of the region where your resource group is located. For example:

<region>westus</region>

similar way you can add the values dynamically Press Ctrl+S to save your _pom.xml_ file, and then press Ctrl+Q to close the code editor.

Refer here for azure-functions-app-with-maven-plugin

Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15