Skip to content

allthatjava/boot-example-azure-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

For typical Azure Function example go here. This is Spring Boot example for Azure Function.

To run the code

Enter the proper values in the following properties img/maven_config.png <start-class> is crucial properties to have. If you don't set it, Azure Function service will not know the Main Class and fail to start the function

  • For deployment to Azure, following plugin is essential
           <plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-functions-maven-plugin</artifactId>
                <version>${azure.functions.maven.plugin.version}</version>

                <configuration>
            ...
                </configuration>
           </plugin>
  • Also, requires host.json file and local.settings.json file in /src/main/resources directory

  • One thing to note is it uses ANONYMOUS option, so it can be access without Access Key

    @FunctionName("httpWithName")
    public String httpWithNameMethod(
            @HttpTrigger(name = "req", methods = { HttpMethod.GET, HttpMethod.POST }, 
                    authLevel = AuthorizationLevel.ANONYMOUS
            ) HttpRequestMessage<Optional<String>> request,
            ExecutionContext context) {

To deploy to Azure

first run the maven package command mvn clean package then deploy with maven-azure command mvn azure-functions:deploy

It will bring up OAuth login screen. Login with Microsoft Login ID. Then select subscription if you have more than 1 subscription on Azure. Then it will show the message that deployment is completed and show the functions link.

About

Azure Function implemented in Spring Boot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages