-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Deploying to Flex Consumption plan with maven fails #2519
Comments
Btw., I used this documentation to configure maven: https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details |
@davosian Thanks a lot for your report and sorry for the late response. Maven plugin called kudu api |
@Flanker32 certainly! Here are the steps I performed: azd init --template azure-functions-java-flex-consumption-azd
(creating local.settings.json)
azd auth login
azd env set SKIP_VNET true
azd up
cd http
(upating pom.xml)
az login
mvn clean package azure-functions:deploy -X Since this is a very generic setup, feel free to reproduce these steps for yourself. I am curious to know whether this works in your environment. This is the {
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "java"
}
} This is the updated <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.contoso</groupId>
<artifactId>contoso-functions</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Azure Java Functions</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<azure.functions.maven.plugin.version>1.37.0</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>3.1.0</azure.functions.java.library.version>
<functionAppName>func-api-4frwx3l2fnxrg-functions</functionAppName>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.11.0-M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.15.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.12.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</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>rg-flexconsumption</resourceGroup>
<!-- function app service plan name -->
<!-- <appServicePlanName>java-functions-app-service-plan</appServicePlanName> -->
<#Tier>Flex Consumption</#Tier>
<!-- function app region-->
<!-- refers
https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-regions
for all valid values -->
<region>swedencentral</region>
<!--
<storageAuthenticationMethod>UserAssignedIdentity</storageAuthenticationMethod> -->
<!--
<userAssignedIdentityResourceId>0a80886b-d24a-4380-aa02-7cbe0c870fc8</userAssignedIdentityResourceId> -->
<!-- function #Tier, default to be consumption if not specified -->
<!-- refers
https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-#-tiers
for all valid values -->
<!-- <#Tier></#Tier> -->
<!-- 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>17</javaVersion>
</runtime>
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~4</value>
</property>
</appSettings>
<!-- using the one created by azd up -->
<appServicePlanName>plan-4frwx3l2fnxrg</appServicePlanName>
<!-- using the one created by azd up -->
<appInsightsKey>9d92bb5f-a956-42a0-b893-f0c230633535</appInsightsKey>
<!-- using the one created by azd up -->
<appInsightsInstance>appi-4frwx3l2fnxrg</appInsightsInstance>
<!-- using the one created by azd up -->
<deploymentStorageAccount>st4frwx3l2fnxrg</deploymentStorageAccount>
<deploymentStorageResourceGroup>rg-flexconsumption</deploymentStorageResourceGroup>
<deploymentStorageContainer>deploymentpackage</deploymentStorageContainer>
<storageAuthenticationMethod>UserAssignedIdentity</storageAuthenticationMethod>
<!-- using the one created by azd up -->
<userAssignedIdentityResourceId>id-api-4frwx3l2fnxrg</userAssignedIdentityResourceId>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<!--Remove
obj folder generated by .NET SDK in maven clean-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project> This is what I have changed compared to the automatically generated
Here is again the error message I am getting:
I do not understand why it is trying to use key based authentication for the storage account since I am telling it to use UserAssignedIdentity. |
Here is the debug log:
|
When deploying with
mvn clean package azure-functions:deploy
, I keep getting this error:Steps to reproduce
I created a flex consumption based project by following these instructions: https://github.com/Azure-Samples/azure-functions-java-flex-consumption-azd
This gives me a function with a user managed identity on the flex consumption plan. Deploying with
azd
does work fine:Then I updated the
pom.xml
to deploy with maven instead:Triggering the deployment with maven:
This results in the above error on the deployment goal (the clean and package steps work fine):
I tried many variations in this pom (e.g. using the client id for userAssignedIdentityResourceId) but no matter what, I end up with this error.
According to this error, the maven build is not honoring the user based identity authentication. The authentication itself is most likely ok with proper roles for the user assigned identity, because the deployment with
azd deploy
does work and - from my understanding - is using the same authentication (azure cli and user assigned identity) so I am not sure what is going on.The text was updated successfully, but these errors were encountered: