Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set property values from azure-maven-plugin ? #2343

Open
sreyanps opened this issue Aug 8, 2023 · 1 comment
Open

Ability to set property values from azure-maven-plugin ? #2343

sreyanps opened this issue Aug 8, 2023 · 1 comment

Comments

@sreyanps
Copy link

sreyanps commented Aug 8, 2023

azure-maven-plugin

Is there a way to read or set values from the field in the azure-maven-plugin ?

        <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>${resourceGroupName}</resourceGroup>
                    <!-- function app service plan name -->
                    <appServicePlanName>${appServicePlanName}</appServicePlanName>
                    <!-- function app region-->
                    <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions for all valid values -->
                    <region>${azure.region}</region>
                    <!-- function pricingTier, default to be consumption if not specified -->
                    <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
                    <!-- <pricingTier></pricingTier> -->

                    <!-- Whether to disable application insights, default is false -->
                    <!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details for all valid configurations for application insights-->
                    <!-- <disableAppInsights></disableAppInsights> -->
                    <runtime>
                        <!-- runtime os, could be windows, linux or docker-->
                        <os>Linux</os>
                        <javaVersion>11</javaVersion>
                        <!-- for docker function, please set the following parameters -->
                        <!-- <image>[hub-user/]repo-name[:tag]</image> -->
                        <!-- <serverId></serverId> -->
                        <!-- <registryUrl></registryUrl>  -->
                    </runtime>
                    <appSettings>
                        <property>
                            <name>FUNCTIONS_EXTENSION_VERSION</name>
                            <value>~4</value>
                        </property>
                    </appSettings>
                </configuration>
                <executions>
                    <execution>
                        <id>package-functions</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


Something like
System.getenv("FUNCTIONS_EXTENSION_VERSION");
or
System.getProperty("FUNCTIONS_EXTENSION_VERSION");

@Flanker32
Copy link
Member

@sreyanps Thanks for your report and really sorry for the late response. Yes you could get the app settings with System.getenv("FUNCTIONS_EXTENSION_VERSION");, and functions maven plugin will help you set the app settings defined in pom to Azure after deployment.

However, if you want to test it locally with mvn azure-functions:run, you need to set the value in local.settings.json, which by default locate in the root of your project, here is an example

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "java",
    "FUNCTIONS_EXTENSION_VERSION": "4"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants