azure-maven-plugins icon indicating copy to clipboard operation
azure-maven-plugins copied to clipboard

Functions deploment failures with authentication via Service Principal

Open miguelch96 opened this issue 3 years ago • 4 comments

Plugin name and version

Plugin/Version:

azure-functions-maven-plugin / 1.4.0

Plugin configuration in your pom.xml

<azure.functions.maven.plugin.version>1.8.0</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.4.0</azure.functions.java.library.version>

        <plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-functions-maven-plugin</artifactId>
                <version>${azure.functions.maven.plugin.version}</version>
                <configuration>
                    <auth>            
                        <client>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</client>
                        <tenant>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</tenant>
                        <certificate>path\to\your.pem</certificate>
                        <environment>AZURE</environment>
                    </auth>
                    <appName>${functionAppName}</appName>
                    <resourceGroup>functions-rg</resourceGroup>
                    <appServicePlanName>yourappserviceplan</appServicePlanName>
                    <region>eastus2</region>
                    <runtime>
                        <os>linux</os>
                        <javaVersion>8</javaVersion>
                    </runtime>
                    <appSettings>
                        <property>
                            <name>FUNCTIONS_EXTENSION_VERSION</name>
                            <value>~3</value>
                        </property>
                    </appSettings>
                </configuration>
                <executions>
                    <execution>
                        <id>package-functions</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Expected behavior

Deployment succeeds

Actual behavior

Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:1.8.0:deploy (default-cli) on project Functions: Execution default-cli of goal com.microsoft.azure:azure-functions-maven-plugin:1.8.0:deploy failed: An API incompatibility was encountered while executing com.microsoft.azure:azure-functions-maven-plugin:1.8.0:deploy: java.lang.NoSuchMethodError: com.nimbusds.jwt.JWTClaimsSet.toJSONObject()Lnet/minidev/json/JSONObject;

image

image

image

image

Steps to reproduce the problem

Enable authentication with service principal certificate at azure-functions-maven-plugin configuration tag

<auth>            
               <client>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</client>
               <tenant>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</tenant>
               <certificate>path\to\your.pem</certificate>
               <environment>AZURE</environment>
</auth>

Workaround

Downgrade nimbus-jose-jtw plugin from 9.0 to 8.20

<dependencies>
                    <dependency>
                        <groupId>com.nimbusds</groupId>
                        <artifactId>nimbus-jose-jwt</artifactId>
                        <version>8.20</version>
                    </dependency>
</dependencies>

image

image

miguelch96 avatar Sep 09 '20 02:09 miguelch96

@miguelch96 Thanks for your report, will looking into this issue soon

Flanker32 avatar Sep 14 '20 06:09 Flanker32

We cannot help since our dependency azure java sdk have version conflictions: see this issue: https://github.com/Azure/azure-sdk-for-java/issues/14898

andxu avatar Oct 30 '20 10:10 andxu

Is there plan to resolve the issue in upcoming nimbus-jose-jwt plugin version?

Can you please provide an update on this when this issue will get resolved rather than applying an workaround

ParimaladeviVadivel avatar Jan 19 '21 08:01 ParimaladeviVadivel

this issue should have disappeared in latest versions since we have upgraded the azure-sdk dependencies.

wangmingliang-ms avatar Sep 20 '22 09:09 wangmingliang-ms