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

publish to azure via "mvn azure-functions:deploy" doesn't support service principal #125

Closed
danyongliu opened this issue Apr 8, 2018 · 8 comments

Comments

@danyongliu
Copy link

Repeat the problem:

  1. login to azure through service principal (https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli?view=azure-cli-latest#logging-in-with-a-service-principal)
  2. Run "mvn azure-functions:deploy" to deploy the function
  3. Error like "Failed to execute goal com.microsoft.azure:azure-functions-maven-plugin:0.2.0:deploy (default-cli) on project xxx: java.io.IOException: clientId is null or empty" will be fired
@jdneo
Copy link
Member

jdneo commented Apr 13, 2018

Hi @danyongliu

Currently Azure CLi login through service principal is not supported yet. For a work around, you can set the service principal in the Maven's setting.xml.

Check this for more details: https://github.com/Microsoft/azure-maven-plugins/blob/master/docs/common-configuration.md#authentication-method-1-use-the-maven-settingsxml-file

@jdneo
Copy link
Member

jdneo commented May 29, 2018

Related issue: Azure/azure-libraries-for-java#417

@sohelsyed
Copy link

I still see an issue even with settings.xml

What did you pass in plugin configuration ? I am passing below

com.microsoft.azure azure-webapp-maven-plugin azure-auth ${functionAppName}

@javisst
Copy link

javisst commented May 10, 2019

Hi! Is this still being worked on? We need this for our build pipelines.

@Flanker32
Copy link
Member

Sorry for the delay
@sohelsyed In plugin configuration, we need to pass the authentication profile id and save the client/tenant/key into maven settings.xml, here is an example.

  • settings.xml
  <servers>
    <server>
      <id>verify</id>
      <configuration>
        <client>${CLIENT ID}</client>
        <tenant>${TENANT ID}</tenant>
        <key>${KEY}</key>
        <environment>AZURE</environment>
      </configuration>
    </server>
  </servers>
  • maven plugin configuration
<plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-webapp-maven-plugin</artifactId>
        <version>1.6.0</version>
        <configuration>
          <authentication>
            <serverId>verify</serverId>
          </authentication>
          ...

@javisst Yes, we are still looking for solutions for this issue, before this, please set the service principal in maven's setting file as a workaround.

@EricZhangzf
Copy link

Hi @Flanker32 ,
I have verified this issue today, it still reproduces on Mac OS, here is my repro steps.
1. Run: az login --service-principal -u <app-url> -p <password-or-cert> --tenant <tenant> on bash.
image

2.Run: mvn azure-webapp:deploy.
image

My azure-cli version is 2.0.67, it works well on Windows.

@EricZhangzf
Copy link

The reason is because some of the caches in the log have not been cleared, and re-generation after clear will solve the problem.

@Flanker32
Copy link
Member

This was caused by an issue of autorest-clientruntime-for-java and has been fixed in webapp plugin 1.7.0 and function plugin 1.3.3

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

No branches or pull requests

6 participants