├── initial ├── src │ └── main │ │ └── java │ │ └── hello │ │ ├── .gitignore │ │ └── Application.java ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── pom.xml ├── gradlew.bat ├── mvnw.cmd ├── gradlew └── mvnw ├── .github ├── dco.yml ├── workflows │ └── continuous-integration-build.yml └── dependabot.yml ├── LICENSE.writing.txt ├── complete ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── src │ ├── main │ │ └── java │ │ │ └── hello │ │ │ ├── Application.java │ │ │ └── GreetingController.java │ └── test │ │ └── java │ │ └── hello │ │ └── GreetingControllerTest.java ├── build.gradle ├── .mvn │ └── wrapper │ │ └── maven-wrapper.properties ├── pom.xml ├── gradlew.bat ├── mvnw.cmd ├── gradlew └── mvnw ├── azure.yaml ├── CONTRIBUTING.adoc ├── .gitignore ├── infra ├── main.parameters.json ├── modules │ └── springapps │ │ ├── springappsStandard.bicep │ │ └── springappsConsumption.bicep ├── azuredeploy-asa-enterprise.json ├── azuredeploy-asa-standard.json ├── azuredeploy-asa-consumption.json ├── azuredeploy │ ├── check-provision-state.ps1 │ ├── deploy-jar-to-asa.sh │ ├── upload-jar-to-asa.sh │ ├── standard.json │ ├── consumption.json │ └── enterprise.json ├── main.bicep ├── abbreviations.json └── azuredeploy.json ├── README.adoc └── LICENSE.txt /initial/src/main/java/hello/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.github/dco.yml: -------------------------------------------------------------------------------- 1 | require: 2 | members: false 3 | -------------------------------------------------------------------------------- /LICENSE.writing.txt: -------------------------------------------------------------------------------- 1 | Except where otherwise noted, this work is licensed under http://creativecommons.org/licenses/by-nd/3.0/ 2 | -------------------------------------------------------------------------------- /complete/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/gs-spring-boot-for-azure/HEAD/complete/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /initial/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spring-guides/gs-spring-boot-for-azure/HEAD/initial/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /initial/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /complete/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /.github/workflows/continuous-integration-build.yml: -------------------------------------------------------------------------------- 1 | name: CI Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | build: 13 | uses: spring-guides/getting-started-macros/.github/workflows/build_initial_complete_maven_gradle.yml@main 14 | -------------------------------------------------------------------------------- /azure.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json 2 | 3 | name: gs-spring-boot-for-azure 4 | metadata: 5 | template: gs-spring-boot-for-azure@0.0.1-beta 6 | services: 7 | demo: 8 | project: ./complete/ 9 | host: springapp 10 | language: java 11 | -------------------------------------------------------------------------------- /complete/src/main/java/hello/Application.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /initial/src/main/java/hello/Application.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class Application { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(Application.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.adoc: -------------------------------------------------------------------------------- 1 | All commits must include a __Signed-off-by__ trailer at the end of each commit message to indicate that the contributor agrees to the Developer Certificate of Origin. 2 | For additional details, please refer to the blog post https://spring.io/blog/2025/01/06/hello-dco-goodbye-cla-simplifying-contributions-to-spring[Hello DCO, Goodbye CLA: Simplifying Contributions to Spring]. 3 | -------------------------------------------------------------------------------- /complete/src/main/java/hello/GreetingController.java: -------------------------------------------------------------------------------- 1 | package hello; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.ResponseBody; 6 | 7 | @Controller 8 | public class GreetingController { 9 | 10 | @RequestMapping("/") 11 | public @ResponseBody String greeting() { 12 | return "Hello World"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Operating System Files 2 | 3 | *.DS_Store 4 | Thumbs.db 5 | *.sw? 6 | .#* 7 | *# 8 | *~ 9 | *.sublime-* 10 | 11 | # Build Artifacts 12 | 13 | .gradle/ 14 | build/ 15 | target/ 16 | bin/ 17 | dependency-reduced-pom.xml 18 | 19 | # Eclipse Project Files 20 | 21 | .classpath 22 | .project 23 | .settings/ 24 | 25 | # IntelliJ IDEA Files 26 | 27 | *.iml 28 | *.ipr 29 | *.iws 30 | *.idea 31 | 32 | README.html 33 | 34 | # AZD files 35 | .azure 36 | -------------------------------------------------------------------------------- /initial/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'org.springframework.boot' version '3.3.0' 4 | } 5 | 6 | apply plugin: 'io.spring.dependency-management' 7 | 8 | group = 'com.example' 9 | version = '0.0.1-SNAPSHOT' 10 | sourceCompatibility = '17' 11 | 12 | repositories { 13 | mavenCentral() 14 | } 15 | 16 | dependencies { 17 | implementation 'org.springframework.boot:spring-boot-starter-web' 18 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 19 | } 20 | 21 | tasks.named('test') { 22 | useJUnitPlatform() 23 | } 24 | -------------------------------------------------------------------------------- /complete/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | id 'org.springframework.boot' version '3.3.0' 4 | } 5 | 6 | apply plugin: 'io.spring.dependency-management' 7 | 8 | group = 'com.example' 9 | version = '0.0.1-SNAPSHOT' 10 | sourceCompatibility = '17' 11 | 12 | repositories { 13 | mavenCentral() 14 | } 15 | 16 | dependencies { 17 | implementation 'org.springframework.boot:spring-boot-starter-web' 18 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 19 | } 20 | 21 | tasks.named('test') { 22 | useJUnitPlatform() 23 | } 24 | -------------------------------------------------------------------------------- /infra/main.parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "environmentName": { 6 | "value": "${AZURE_ENV_NAME}" 7 | }, 8 | "location": { 9 | "value": "${AZURE_LOCATION}" 10 | }, 11 | "principalId": { 12 | "value": "${AZURE_PRINCIPAL_ID}" 13 | }, 14 | "relativePath": { 15 | "value": "${SERVICE_DEMO_RELATIVE_PATH=}" 16 | }, 17 | "plan": { 18 | "value": "${PLAN=consumption}" 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | 4 | - package-ecosystem: "maven" 5 | directories: 6 | - "/initial" 7 | - "/complete" 8 | ignore: 9 | - dependency-name: "*" 10 | update-types: ["version-update:semver-patch"] 11 | schedule: 12 | interval: "monthly" 13 | target-branch: "main" 14 | groups: 15 | guide-dependencies-maven: 16 | patterns: 17 | - "*" 18 | 19 | - package-ecosystem: "gradle" 20 | directories: 21 | - "/initial" 22 | - "/complete" 23 | ignore: 24 | - dependency-name: "*" 25 | update-types: ["version-update:semver-patch"] 26 | schedule: 27 | interval: "monthly" 28 | target-branch: "main" 29 | groups: 30 | guide-dependencies-gradle: 31 | patterns: 32 | - "*" -------------------------------------------------------------------------------- /complete/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip 20 | -------------------------------------------------------------------------------- /initial/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip 20 | -------------------------------------------------------------------------------- /infra/modules/springapps/springappsStandard.bicep: -------------------------------------------------------------------------------- 1 | param asaInstanceName string 2 | param appName string 3 | param location string = resourceGroup().location 4 | param tags object = {} 5 | param relativePath string 6 | 7 | resource asaInstance 'Microsoft.AppPlatform/Spring@2022-12-01' = { 8 | name: asaInstanceName 9 | location: location 10 | tags: union(tags, { 'azd-service-name': appName }) 11 | sku: { 12 | name: 'S0' 13 | tier: 'Standard' 14 | } 15 | } 16 | 17 | resource asaApp 'Microsoft.AppPlatform/Spring/apps@2022-12-01' = { 18 | name: appName 19 | location: location 20 | parent: asaInstance 21 | properties: { 22 | public: true 23 | } 24 | } 25 | 26 | resource asaDeployment 'Microsoft.AppPlatform/Spring/apps/deployments@2022-12-01' = { 27 | name: 'default' 28 | parent: asaApp 29 | properties: { 30 | deploymentSettings: { 31 | resourceRequests: { 32 | cpu: '1' 33 | memory: '2Gi' 34 | } 35 | } 36 | source: { 37 | type: 'Jar' 38 | runtimeVersion: 'Java_17' 39 | relativePath: relativePath 40 | } 41 | } 42 | } 43 | 44 | output name string = asaApp.name 45 | output uri string = 'https://${asaApp.properties.url}' 46 | -------------------------------------------------------------------------------- /infra/azuredeploy-asa-enterprise.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { }, 5 | "resources": [ 6 | { 7 | "type": "Microsoft.Resources/deployments", 8 | "apiVersion": "2022-09-01", 9 | "name": "[format('{0}--asa', deployment().name)]", 10 | "properties": { 11 | "expressionEvaluationOptions": { 12 | "scope": "inner" 13 | }, 14 | "mode": "Incremental", 15 | "parameters": { 16 | "plan": { 17 | "value": "enterprise" 18 | }, 19 | "location": { 20 | "value": "[resourceGroup().location]" 21 | } 22 | }, 23 | "templateLink": { 24 | "relativePath": "azuredeploy.json", 25 | "contentVersion":"1.0.0.0" 26 | } 27 | } 28 | } 29 | ], 30 | "outputs": { 31 | "Name": { 32 | "type": "string", 33 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.Name.value]" 34 | }, 35 | "URL": { 36 | "type": "string", 37 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.URL.value]" 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /infra/azuredeploy-asa-standard.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { }, 5 | "resources": [ 6 | { 7 | "type": "Microsoft.Resources/deployments", 8 | "apiVersion": "2022-09-01", 9 | "name": "[format('{0}--asa', deployment().name)]", 10 | "properties": { 11 | "expressionEvaluationOptions": { 12 | "scope": "inner" 13 | }, 14 | "mode": "Incremental", 15 | "parameters": { 16 | "plan": { 17 | "value": "standard" 18 | }, 19 | "location": { 20 | "value": "[resourceGroup().location]" 21 | } 22 | }, 23 | "templateLink": { 24 | "relativePath": "azuredeploy.json", 25 | "contentVersion":"1.0.0.0" 26 | } 27 | } 28 | } 29 | ], 30 | "outputs": { 31 | "Name": { 32 | "type": "string", 33 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.Name.value]" 34 | }, 35 | "URL": { 36 | "type": "string", 37 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.URL.value]" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /infra/azuredeploy-asa-consumption.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { }, 5 | "resources": [ 6 | { 7 | "type": "Microsoft.Resources/deployments", 8 | "apiVersion": "2022-09-01", 9 | "name": "[format('{0}--asa', deployment().name)]", 10 | "properties": { 11 | "expressionEvaluationOptions": { 12 | "scope": "inner" 13 | }, 14 | "mode": "Incremental", 15 | "parameters": { 16 | "plan": { 17 | "value": "consumption" 18 | }, 19 | "location": { 20 | "value": "[resourceGroup().location]" 21 | } 22 | }, 23 | "templateLink": { 24 | "relativePath": "azuredeploy.json", 25 | "contentVersion":"1.0.0.0" 26 | } 27 | } 28 | } 29 | ], 30 | "outputs": { 31 | "Name": { 32 | "type": "string", 33 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.Name.value]" 34 | }, 35 | "URL": { 36 | "type": "string", 37 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--asa', deployment().name)), '2022-09-01').outputs.URL.value]" 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /complete/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.0 9 | 10 | 11 | com.example 12 | demo 13 | 0.0.1-SNAPSHOT 14 | boot-for-azure 15 | Demo project for Spring Boot 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-maven-plugin 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /initial/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 3.3.0 9 | 10 | 11 | com.example 12 | demo 13 | 0.0.1-SNAPSHOT 14 | boot-for-azure 15 | Demo project for Spring Boot 16 | 17 | 17 18 | 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-test 28 | test 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-maven-plugin 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /infra/modules/springapps/springappsConsumption.bicep: -------------------------------------------------------------------------------- 1 | param location string = resourceGroup().location 2 | param asaManagedEnvironmentName string 3 | param asaInstanceName string 4 | param appName string 5 | param tags object = {} 6 | param relativePath string 7 | 8 | resource asaManagedEnvironment 'Microsoft.App/managedEnvironments@2022-11-01-preview' = { 9 | name: asaManagedEnvironmentName 10 | location: location 11 | tags: tags 12 | properties: { 13 | workloadProfiles: [ 14 | { 15 | name: 'Consumption' 16 | workloadProfileType: 'Consumption' 17 | } 18 | ] 19 | } 20 | } 21 | 22 | resource asaInstance 'Microsoft.AppPlatform/Spring@2023-03-01-preview' = { 23 | name: asaInstanceName 24 | location: location 25 | tags: union(tags, { 'azd-service-name': appName }) 26 | sku: { 27 | name: 'S0' 28 | tier: 'StandardGen2' 29 | } 30 | properties: { 31 | managedEnvironmentId: asaManagedEnvironment.id 32 | } 33 | } 34 | 35 | resource asaApp 'Microsoft.AppPlatform/Spring/apps@2023-03-01-preview' = { 36 | name: appName 37 | location: location 38 | parent: asaInstance 39 | properties: { 40 | public: true 41 | } 42 | } 43 | 44 | resource asaDeployment 'Microsoft.AppPlatform/Spring/apps/deployments@2023-03-01-preview' = { 45 | name: 'default' 46 | parent: asaApp 47 | properties: { 48 | source: { 49 | type: 'Jar' 50 | relativePath: relativePath 51 | runtimeVersion: 'Java_17' 52 | } 53 | deploymentSettings: { 54 | resourceRequests: { 55 | cpu: '1' 56 | memory: '2Gi' 57 | } 58 | } 59 | } 60 | } 61 | 62 | output name string = asaApp.name 63 | output uri string = 'https://${asaApp.properties.url}' -------------------------------------------------------------------------------- /infra/azuredeploy/check-provision-state.ps1: -------------------------------------------------------------------------------- 1 | 2 | [CmdLetBinding()] 3 | param() 4 | 5 | $subscriptionId = $env:SUBSCRIPTION_ID 6 | $resourceGroup = $env:RESOURCE_GROUP 7 | $asaServiceName = $env:ASA_SERVICE_NAME 8 | 9 | # Fail fast the deployment if envs are empty 10 | if (!$subscriptionId) { 11 | Write-Error "The subscription Id is not successfully retrieved, please retry another deployment." 12 | exit 1 13 | } 14 | if (!$resourceGroup) { 15 | Write-Error "The resource group is not successfully retrieved, please retry another deployment." 16 | exit 1 17 | } 18 | if (!$asaServiceName) { 19 | Write-Error "The Azure Spring Apps service name is not successfully retrieved, please retry another deployment." 20 | exit 1 21 | } 22 | 23 | $apiUrl = 'https://management.azure.com/subscriptions/' + $subscriptionId + '/resourceGroups/' + $resourceGroup + '/providers/Microsoft.AppPlatform/Spring/' + $asaServiceName + '/buildServices/default/builders/default?api-version=2023-05-01-preview' 24 | $state = $null 25 | $timeout = New-TimeSpan -Seconds 600 26 | Write-Output "Check the status of Build Service Builder provisioning state within $timeout ..." 27 | $sw = [System.Diagnostics.Stopwatch]::StartNew() 28 | $accessToken = (Get-AzAccessToken).Token 29 | $headers = @{ 30 | 'Authorization' = 'Bearer ' + $accessToken 31 | } 32 | $Succeeded = 'Succeeded' 33 | while ($sw.Elapsed -lt $timeout) { 34 | $response = Invoke-WebRequest -Uri $apiUrl -Headers $headers -Method GET 35 | $content = $response.Content | ConvertFrom-Json 36 | $state = $content.properties.provisioningState 37 | if ($state -eq $Succeeded) { 38 | break 39 | } 40 | Start-Sleep -Seconds 5 41 | } 42 | Write-Output "State: $state" 43 | if ($state -ne $Succeeded) { 44 | Write-Error "The Build Service Builder provisioning state is not succeeded." 45 | exit 1 46 | } 47 | -------------------------------------------------------------------------------- /complete/src/test/java/hello/GreetingControllerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package hello; 17 | 18 | import static org.hamcrest.Matchers.containsString; 19 | import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; 20 | import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; 21 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; 22 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; 23 | 24 | import org.junit.jupiter.api.Test; 25 | import org.junit.jupiter.api.extension.ExtendWith; 26 | import org.springframework.beans.factory.annotation.Autowired; 27 | import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; 28 | import org.springframework.boot.test.context.SpringBootTest; 29 | import org.springframework.test.context.junit.jupiter.SpringExtension; 30 | import org.springframework.test.web.servlet.MockMvc; 31 | 32 | @ExtendWith(SpringExtension.class) 33 | @SpringBootTest 34 | @AutoConfigureMockMvc 35 | public class GreetingControllerTest { 36 | 37 | @Autowired 38 | private MockMvc mockMvc; 39 | 40 | @Test 41 | public void greetingShouldReturnDefaultMessage() throws Exception { 42 | 43 | this.mockMvc.perform(get("/")).andDo(print()).andExpect(status().isOk()) 44 | .andExpect(content().string(containsString("Hello World"))); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /infra/azuredeploy/deploy-jar-to-asa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright (c) Microsoft Corporation. 4 | # Copyright (c) IBM Corporation. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | set -Eeuo pipefail 19 | 20 | # Fail fast the deployment if envs are empty 21 | if [[ -z "$SUBSCRIPTION_ID" ]]; then 22 | echo "The subscription Id is not successfully retrieved, please retry another deployment." >&2 23 | exit 1 24 | fi 25 | 26 | if [[ -z "$RESOURCE_GROUP" ]]; then 27 | echo "The resource group is not successfully retrieved, please retry another deployment." >&2 28 | exit 1 29 | fi 30 | 31 | if [[ -z "$ASA_SERVICE_NAME" ]]; then 32 | echo "The Azure Spring Apps service name is not successfully retrieved, please retry another deployment." >&2 33 | exit 1 34 | fi 35 | 36 | jar_file_name="hello-world-0.0.1.jar" 37 | source_url="https://github.com/Azure/spring-cloud-azure-tools/releases/download/0.0.1/$jar_file_name" 38 | auth_header="no-auth" 39 | 40 | # Download binary 41 | echo "Downloading binary from $source_url to $jar_file_name" 42 | if [ "$auth_header" == "no-auth" ]; then 43 | curl -L "$source_url" -o $jar_file_name 44 | else 45 | curl -H "Authorization: $auth_header" "$source_url" -o $jar_file_name 46 | fi 47 | 48 | az extension add --name spring --upgrade 49 | az spring app deploy --resource-group $RESOURCE_GROUP --service $ASA_SERVICE_NAME --name demo --artifact-path $jar_file_name 50 | 51 | # Delete uami generated before exiting the script 52 | az identity delete --ids ${AZ_SCRIPTS_USER_ASSIGNED_IDENTITY} -------------------------------------------------------------------------------- /infra/main.bicep: -------------------------------------------------------------------------------- 1 | targetScope = 'subscription' 2 | 3 | @minLength(1) 4 | @maxLength(64) 5 | @description('Name of the the environment which is used to generate a short unique hash used in all resources.') 6 | param environmentName string 7 | 8 | @minLength(1) 9 | @description('Primary location for all resources') 10 | param location string 11 | 12 | @description('Id of the user or app to assign application roles') 13 | param principalId string = '' 14 | 15 | @description('Relative Path of ASA Jar') 16 | param relativePath string 17 | 18 | @allowed([ 19 | 'consumption' 20 | 'standard' 21 | ]) 22 | param plan string = 'consumption' 23 | 24 | var abbrs = loadJsonContent('./abbreviations.json') 25 | var resourceToken = toLower(uniqueString(subscription().id, environmentName, location)) 26 | var asaManagedEnvironmentName = '${abbrs.appContainerAppsManagedEnvironment}${resourceToken}' 27 | var asaInstanceName = '${abbrs.springApps}${resourceToken}' 28 | var appName = 'demo' 29 | var tags = { 30 | 'azd-env-name': environmentName 31 | 'spring-cloud-azure': 'true' 32 | } 33 | 34 | 35 | // Organize resources in a resource group 36 | resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = { 37 | name: '${abbrs.resourcesResourceGroups}${environmentName}' 38 | location: location 39 | tags: tags 40 | } 41 | 42 | module springAppsConsumption 'modules/springapps/springappsConsumption.bicep' = if (plan == 'consumption') { 43 | name: '${deployment().name}--asaconsumption' 44 | scope: resourceGroup(rg.name) 45 | params: { 46 | location: location 47 | appName: appName 48 | tags: tags 49 | asaManagedEnvironmentName: asaManagedEnvironmentName 50 | asaInstanceName: asaInstanceName 51 | relativePath: relativePath 52 | } 53 | } 54 | 55 | module springAppsStandard 'modules/springapps/springappsStandard.bicep' = if (plan == 'standard') { 56 | name: '${deployment().name}--asastandard' 57 | scope: resourceGroup(rg.name) 58 | params: { 59 | location: location 60 | appName: appName 61 | tags: tags 62 | asaInstanceName: asaInstanceName 63 | relativePath: relativePath 64 | } 65 | } 66 | 67 | output AZURE_RESOURCE_GROUP string = rg.name 68 | 69 | -------------------------------------------------------------------------------- /infra/azuredeploy/upload-jar-to-asa.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -Eeuo pipefail 4 | 5 | # Fail fast the deployment if envs are empty 6 | if [[ -z "$SUBSCRIPTION_ID" ]]; then 7 | echo "The subscription Id is not successfully retrieved, please retry another deployment." >&2 8 | exit 1 9 | fi 10 | 11 | if [[ -z "$RESOURCE_GROUP" ]]; then 12 | echo "The resource group is not successfully retrieved, please retry another deployment." >&2 13 | exit 1 14 | fi 15 | 16 | if [[ -z "$ASA_SERVICE_NAME" ]]; then 17 | echo "The Azure Spring Apps service name is not successfully retrieved, please retry another deployment." >&2 18 | exit 1 19 | fi 20 | 21 | get_resource_upload_url_result=$(az rest -m post -u "https://management.azure.com/subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP/providers/Microsoft.AppPlatform/Spring/$ASA_SERVICE_NAME/apps/demo/getResourceUploadUrl?api-version=2023-05-01-preview") 22 | upload_url=$(echo $get_resource_upload_url_result | jq -r '.uploadUrl') 23 | relative_path=$(echo $get_resource_upload_url_result | jq -r '.relativePath') 24 | source_url="https://github.com/Azure/spring-cloud-azure-tools/releases/download/0.0.1/hello-world-0.0.1.jar" 25 | auth_header="no-auth" 26 | 27 | storage_account_name=$(echo $upload_url | awk -F'[/.]' '{print $3}') 28 | storage_endpoint=$(echo $upload_url | awk -F'/' '{print "https://" $3}') 29 | share_name=$(echo $upload_url | awk -F'/' '{print $4}') 30 | folder=$(echo $upload_url | awk -F'?' '{print $1}' | awk -F'/' '{for(i=5;i $AZ_SCRIPTS_OUTPUT_PATH 52 | 53 | # Delete uami generated before exiting the script 54 | az identity delete --ids ${AZ_SCRIPTS_USER_ASSIGNED_IDENTITY} 55 | -------------------------------------------------------------------------------- /initial/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /complete/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 48 | echo. 49 | echo Please set the JAVA_HOME variable in your environment to match the 50 | echo location of your Java installation. 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 62 | echo. 63 | echo Please set the JAVA_HOME variable in your environment to match the 64 | echo location of your Java installation. 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /infra/abbreviations.json: -------------------------------------------------------------------------------- 1 | { 2 | "analysisServicesServers": "as", 3 | "apiManagementService": "apim-", 4 | "appConfigurationConfigurationStores": "appcs-", 5 | "appManagedEnvironments": "cae-", 6 | "appContainerApps": "ca-", 7 | "appContainerAppsManagedEnvironment": "env-", 8 | "authorizationPolicyDefinitions": "policy-", 9 | "automationAutomationAccounts": "aa-", 10 | "blueprintBlueprints": "bp-", 11 | "blueprintBlueprintsArtifacts": "bpa-", 12 | "cacheRedis": "redis-", 13 | "cdnProfiles": "cdnp-", 14 | "cdnProfilesEndpoints": "cdne-", 15 | "cognitiveServicesAccounts": "cog-", 16 | "cognitiveServicesFormRecognizer": "cog-fr-", 17 | "cognitiveServicesTextAnalytics": "cog-ta-", 18 | "computeAvailabilitySets": "avail-", 19 | "computeCloudServices": "cld-", 20 | "computeDiskEncryptionSets": "des", 21 | "computeDisks": "disk", 22 | "computeDisksOs": "osdisk", 23 | "computeGalleries": "gal", 24 | "computeSnapshots": "snap-", 25 | "computeVirtualMachines": "vm", 26 | "computeVirtualMachineScaleSets": "vmss-", 27 | "containerInstanceContainerGroups": "ci", 28 | "containerRegistryRegistries": "cr", 29 | "containerServiceManagedClusters": "aks-", 30 | "databricksWorkspaces": "dbw-", 31 | "dataFactoryFactories": "adf-", 32 | "dataLakeAnalyticsAccounts": "dla", 33 | "dataLakeStoreAccounts": "dls", 34 | "dataMigrationServices": "dms-", 35 | "dBforMySQLServers": "mysql-", 36 | "dBforPostgreSQLServers": "psql-", 37 | "devicesIotHubs": "iot-", 38 | "devicesProvisioningServices": "provs-", 39 | "devicesProvisioningServicesCertificates": "pcert-", 40 | "documentDBDatabaseAccounts": "cosmos-", 41 | "eventGridDomains": "evgd-", 42 | "eventGridDomainsTopics": "evgt-", 43 | "eventGridEventSubscriptions": "evgs-", 44 | "eventHubNamespaces": "evhns-", 45 | "eventHubNamespacesEventHubs": "evh-", 46 | "hdInsightClustersHadoop": "hadoop-", 47 | "hdInsightClustersHbase": "hbase-", 48 | "hdInsightClustersKafka": "kafka-", 49 | "hdInsightClustersMl": "mls-", 50 | "hdInsightClustersSpark": "spark-", 51 | "hdInsightClustersStorm": "storm-", 52 | "hybridComputeMachines": "arcs-", 53 | "insightsActionGroups": "ag-", 54 | "insightsComponents": "appi-", 55 | "keyVaultVaults": "kv-", 56 | "kubernetesConnectedClusters": "arck", 57 | "kustoClusters": "dec", 58 | "kustoClustersDatabases": "dedb", 59 | "logicIntegrationAccounts": "ia-", 60 | "logicWorkflows": "logic-", 61 | "machineLearningServicesWorkspaces": "mlw-", 62 | "managedIdentityUserAssignedIdentities": "id-", 63 | "managementManagementGroups": "mg-", 64 | "migrateAssessmentProjects": "migr-", 65 | "networkApplicationGateways": "agw-", 66 | "networkApplicationSecurityGroups": "asg-", 67 | "networkAzureFirewalls": "afw-", 68 | "networkBastionHosts": "bas-", 69 | "networkConnections": "con-", 70 | "networkDnsZones": "dnsz-", 71 | "networkExpressRouteCircuits": "erc-", 72 | "networkFirewallPolicies": "afwp-", 73 | "networkFirewallPoliciesWebApplication": "waf", 74 | "networkFirewallPoliciesRuleGroups": "wafrg", 75 | "networkFrontDoors": "fd-", 76 | "networkFrontdoorWebApplicationFirewallPolicies": "fdfp-", 77 | "networkLoadBalancersExternal": "lbe-", 78 | "networkLoadBalancersInternal": "lbi-", 79 | "networkLoadBalancersInboundNatRules": "rule-", 80 | "networkLocalNetworkGateways": "lgw-", 81 | "networkNatGateways": "ng-", 82 | "networkNetworkInterfaces": "nic-", 83 | "networkNetworkSecurityGroups": "nsg-", 84 | "networkNetworkSecurityGroupsSecurityRules": "nsgsr-", 85 | "networkNetworkWatchers": "nw-", 86 | "networkPrivateDnsZones": "pdnsz-", 87 | "networkPrivateLinkServices": "pl-", 88 | "networkPublicIPAddresses": "pip-", 89 | "networkPublicIPPrefixes": "ippre-", 90 | "networkRouteFilters": "rf-", 91 | "networkRouteTables": "rt-", 92 | "networkRouteTablesRoutes": "udr-", 93 | "networkTrafficManagerProfiles": "traf-", 94 | "networkVirtualNetworkGateways": "vgw-", 95 | "networkVirtualNetworks": "vnet-", 96 | "networkVirtualNetworksSubnets": "snet-", 97 | "networkVirtualNetworksVirtualNetworkPeerings": "peer-", 98 | "networkVirtualWans": "vwan-", 99 | "networkVpnGateways": "vpng-", 100 | "networkVpnGatewaysVpnConnections": "vcn-", 101 | "networkVpnGatewaysVpnSites": "vst-", 102 | "notificationHubsNamespaces": "ntfns-", 103 | "notificationHubsNamespacesNotificationHubs": "ntf-", 104 | "operationalInsightsWorkspaces": "log-", 105 | "portalDashboards": "dash-", 106 | "powerBIDedicatedCapacities": "pbi-", 107 | "purviewAccounts": "pview-", 108 | "postgresServer": "pg-", 109 | "recoveryServicesVaults": "rsv-", 110 | "resourcesResourceGroups": "rg-", 111 | "searchSearchServices": "srch-", 112 | "serviceBusNamespaces": "sb-", 113 | "serviceBusNamespacesQueues": "sbq-", 114 | "serviceBusNamespacesTopics": "sbt-", 115 | "serviceEndPointPolicies": "se-", 116 | "serviceFabricClusters": "sf-", 117 | "signalRServiceSignalR": "sigr", 118 | "springApps": "asa-", 119 | "sqlManagedInstances": "sqlmi-", 120 | "sqlServers": "sql-", 121 | "sqlServersDataWarehouse": "sqldw-", 122 | "sqlServersDatabases": "sqldb-", 123 | "sqlServersDatabasesStretch": "sqlstrdb-", 124 | "storageStorageAccounts": "st", 125 | "storageStorageAccountsVm": "stvm", 126 | "storSimpleManagers": "ssimp", 127 | "streamAnalyticsCluster": "asa-", 128 | "synapseWorkspaces": "syn", 129 | "synapseWorkspacesAnalyticsWorkspaces": "synw", 130 | "synapseWorkspacesSqlPoolsDedicated": "syndp", 131 | "synapseWorkspacesSqlPoolsSpark": "synsp", 132 | "timeSeriesInsightsEnvironments": "tsi-", 133 | "webServerFarms": "plan-", 134 | "webSitesAppService": "app-", 135 | "webSitesAppServiceEnvironment": "ase-", 136 | "webSitesFunctions": "func-", 137 | "webStaticSites": "stapp-" 138 | } -------------------------------------------------------------------------------- /infra/azuredeploy/standard.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "metadata": { 5 | "_generator": { 6 | "name": "bicep", 7 | "version": "0.20.4.51522", 8 | "templateHash": "11586074179217770493" 9 | } 10 | }, 11 | "parameters": { 12 | "asaInstanceName": { 13 | "type": "string" 14 | }, 15 | "appName": { 16 | "type": "string" 17 | }, 18 | "location": { 19 | "type": "string", 20 | "defaultValue": "[resourceGroup().location]" 21 | }, 22 | "tags": { 23 | "type": "object", 24 | "defaultValue": {} 25 | }, 26 | "userAssignedManagedIdentityName": { 27 | "type": "string" 28 | } 29 | }, 30 | "variables": { 31 | "const_ownerRole": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]", 32 | "const_scriptLocation": "https://raw.githubusercontent.com/spring-guides/gs-spring-boot-for-azure/main/infra/azuredeploy/", 33 | "const_uploadScriptName": "upload-jar-to-asa.sh", 34 | "ref_identityId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 35 | "name_deploymentScriptName": "asa-standard-deployment-script", 36 | "name_roleAssignmentName": "[guid(format('{0}{1}Role assignment in group{0}', resourceGroup().name, variables('ref_identityId')))]" 37 | }, 38 | "resources": [ 39 | { 40 | "type": "Microsoft.AppPlatform/Spring", 41 | "apiVersion": "2023-05-01-preview", 42 | "name": "[parameters('asaInstanceName')]", 43 | "location": "[parameters('location')]", 44 | "tags": "[parameters('tags')]", 45 | "sku": { 46 | "name": "S0", 47 | "tier": "Standard" 48 | } 49 | }, 50 | { 51 | "type": "Microsoft.AppPlatform/Spring/apps", 52 | "apiVersion": "2023-05-01-preview", 53 | "name": "[format('{0}/{1}', parameters('asaInstanceName'), parameters('appName'))]", 54 | "location": "[parameters('location')]", 55 | "properties": { 56 | "public": true 57 | }, 58 | "dependsOn": [ 59 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 60 | ] 61 | }, 62 | { 63 | "type": "Microsoft.ManagedIdentity/userAssignedIdentities", 64 | "name": "[parameters('userAssignedManagedIdentityName')]", 65 | "apiVersion": "2023-01-31", 66 | "location": "[parameters('location')]" 67 | }, 68 | { 69 | "type": "Microsoft.Authorization/roleAssignments", 70 | "apiVersion": "2022-04-01", 71 | "name": "[variables('name_roleAssignmentName')]", 72 | "dependsOn": [ 73 | "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 74 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 75 | ], 76 | "properties": { 77 | "roleDefinitionId": "[variables('const_ownerRole')]", 78 | "principalId": "[reference(variables('ref_identityId')).principalId]", 79 | "principalType": "ServicePrincipal", 80 | "scope": "[resourceGroup().id]" 81 | } 82 | }, 83 | { 84 | "type": "Microsoft.Resources/deploymentScripts", 85 | "apiVersion": "2020-10-01", 86 | "name": "[variables('name_deploymentScriptName')]", 87 | "location": "[parameters('location')]", 88 | "dependsOn": [ 89 | "[resourceId('Microsoft.Authorization/roleAssignments', variables('name_roleAssignmentName'))]" 90 | ], 91 | "kind": "AzureCLI", 92 | "identity": { 93 | "type": "UserAssigned", 94 | "userAssignedIdentities": { 95 | "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName')))]": {} 96 | } 97 | }, 98 | "properties": { 99 | "AzCliVersion": "2.41.0", 100 | "primaryScriptUri": "[uri(variables('const_scriptLocation'), variables('const_uploadScriptName'))]", 101 | "environmentVariables": [ 102 | { 103 | "name": "SUBSCRIPTION_ID", 104 | "value": "[subscription().subscriptionId]" 105 | }, 106 | { 107 | "name": "RESOURCE_GROUP", 108 | "value": "[resourceGroup().name]" 109 | }, 110 | { 111 | "name": "ASA_SERVICE_NAME", 112 | "value": "[parameters('asaInstanceName')]" 113 | } 114 | ], 115 | "cleanupPreference": "OnSuccess", 116 | "retentionInterval": "P1D" 117 | } 118 | }, 119 | { 120 | "type": "Microsoft.AppPlatform/Spring/apps/deployments", 121 | "apiVersion": "2023-05-01-preview", 122 | "name": "[format('{0}/{1}/{2}', parameters('asaInstanceName'), parameters('appName'), 'default')]", 123 | "properties": { 124 | "active": true, 125 | "deploymentSettings": { 126 | "resourceRequests": { 127 | "cpu": "1", 128 | "memory": "2Gi" 129 | } 130 | }, 131 | "source": { 132 | "type": "Jar", 133 | "runtimeVersion": "Java_17", 134 | "relativePath": "[reference(variables('name_deploymentScriptName')).outputs.relativePath]" 135 | } 136 | }, 137 | "dependsOn": [ 138 | "[resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName'))]", 139 | "[resourceId('Microsoft.Resources/deploymentScripts', variables('name_deploymentScriptName'))]" 140 | ] 141 | } 142 | ], 143 | "outputs": { 144 | "Name": { 145 | "type": "string", 146 | "value": "[parameters('appName')]" 147 | }, 148 | "URL": { 149 | "type": "string", 150 | "value": "[reference(resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName')), '2023-05-01-preview').url]" 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /infra/azuredeploy/consumption.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "metadata": { 5 | "_generator": { 6 | "name": "bicep", 7 | "version": "0.18.4.5664", 8 | "templateHash": "17541161375002195629" 9 | } 10 | }, 11 | "parameters": { 12 | "asaManagedEnvironmentName": { 13 | "type": "string", 14 | "defaultValue": "[format('containerapp-env-{0}', uniqueString(resourceGroup().id))]", 15 | "metadata": { 16 | "description": "Specifies the name of the container app environment." 17 | } 18 | }, 19 | "asaInstanceName": { 20 | "type": "string" 21 | }, 22 | "appName": { 23 | "type": "string" 24 | }, 25 | "location": { 26 | "type": "string", 27 | "defaultValue": "[resourceGroup().location]" 28 | }, 29 | "tags": { 30 | "type": "object", 31 | "defaultValue": {} 32 | }, 33 | "userAssignedManagedIdentityName": { 34 | "type": "string" 35 | } 36 | }, 37 | "variables": { 38 | "const_ownerRole": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]", 39 | "const_scriptLocation": "https://raw.githubusercontent.com/spring-guides/gs-spring-boot-for-azure/main/infra/azuredeploy/", 40 | "const_uploadScriptName": "upload-jar-to-asa.sh", 41 | "ref_identityId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 42 | "name_deploymentScriptName": "asa-consumption-deployment-script", 43 | "name_roleAssignmentName": "[guid(format('{0}{1}Role assignment in group{0}', resourceGroup().name, variables('ref_identityId')))]" 44 | }, 45 | "resources": [ 46 | { 47 | "type": "Microsoft.App/managedEnvironments", 48 | "apiVersion": "2023-04-01-preview", 49 | "name": "[parameters('asaManagedEnvironmentName')]", 50 | "location": "[parameters('location')]", 51 | "tags": "[parameters('tags')]", 52 | "properties": { 53 | "workloadProfiles": [ 54 | { 55 | "name": "Consumption", 56 | "workloadProfileType": "Consumption" 57 | } 58 | ] 59 | } 60 | }, 61 | { 62 | "type": "Microsoft.AppPlatform/Spring", 63 | "apiVersion": "2023-05-01-preview", 64 | "name": "[parameters('asaInstanceName')]", 65 | "location": "[parameters('location')]", 66 | "tags": "[parameters('tags')]", 67 | "sku": { 68 | "name": "S0", 69 | "tier": "StandardGen2" 70 | }, 71 | "properties": { 72 | "managedEnvironmentId": "[resourceId('Microsoft.App/managedEnvironments', parameters('asaManagedEnvironmentName'))]" 73 | }, 74 | "dependsOn": [ 75 | "[resourceId('Microsoft.App/managedEnvironments', parameters('asaManagedEnvironmentName'))]" 76 | ] 77 | }, 78 | { 79 | "type": "Microsoft.AppPlatform/Spring/apps", 80 | "apiVersion": "2023-05-01-preview", 81 | "name": "[format('{0}/{1}', parameters('asaInstanceName'), parameters('appName'))]", 82 | "location": "[parameters('location')]", 83 | "properties": { 84 | "public": true 85 | }, 86 | "dependsOn": [ 87 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 88 | ] 89 | }, 90 | { 91 | "type": "Microsoft.ManagedIdentity/userAssignedIdentities", 92 | "name": "[parameters('userAssignedManagedIdentityName')]", 93 | "apiVersion": "2023-01-31", 94 | "location": "[parameters('location')]" 95 | }, 96 | { 97 | "type": "Microsoft.Authorization/roleAssignments", 98 | "apiVersion": "2022-04-01", 99 | "name": "[variables('name_roleAssignmentName')]", 100 | "dependsOn": [ 101 | "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 102 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 103 | ], 104 | "properties": { 105 | "roleDefinitionId": "[variables('const_ownerRole')]", 106 | "principalId": "[reference(variables('ref_identityId')).principalId]", 107 | "principalType": "ServicePrincipal", 108 | "scope": "[resourceGroup().id]" 109 | } 110 | }, 111 | { 112 | "type": "Microsoft.Resources/deploymentScripts", 113 | "apiVersion": "2020-10-01", 114 | "name": "[variables('name_deploymentScriptName')]", 115 | "location": "[parameters('location')]", 116 | "kind": "AzureCLI", 117 | "identity": { 118 | "type": "UserAssigned", 119 | "userAssignedIdentities": { 120 | "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName')))]": {} 121 | } 122 | }, 123 | "dependsOn": [ 124 | "[resourceId('Microsoft.Authorization/roleAssignments', variables('name_roleAssignmentName'))]" 125 | ], 126 | "properties": { 127 | "AzCliVersion": "2.41.0", 128 | "primaryScriptUri": "[uri(variables('const_scriptLocation'), variables('const_uploadScriptName'))]", 129 | "environmentVariables": [ 130 | { 131 | "name": "SUBSCRIPTION_ID", 132 | "value": "[subscription().subscriptionId]" 133 | }, 134 | { 135 | "name": "RESOURCE_GROUP", 136 | "value": "[resourceGroup().name]" 137 | }, 138 | { 139 | "name": "ASA_SERVICE_NAME", 140 | "value": "[parameters('asaInstanceName')]" 141 | } 142 | ], 143 | "cleanupPreference": "OnSuccess", 144 | "retentionInterval": "P1D" 145 | } 146 | }, 147 | { 148 | "type": "Microsoft.AppPlatform/Spring/apps/deployments", 149 | "apiVersion": "2023-05-01-preview", 150 | "name": "[format('{0}/{1}/{2}', parameters('asaInstanceName'), parameters('appName'), 'default')]", 151 | "properties": { 152 | "active": true, 153 | "deploymentSettings": { 154 | "resourceRequests": { 155 | "cpu": "1", 156 | "memory": "2Gi" 157 | } 158 | }, 159 | "source": { 160 | "type": "Jar", 161 | "runtimeVersion": "Java_17", 162 | "relativePath": "[reference(variables('name_deploymentScriptName')).outputs.relativePath]" 163 | } 164 | }, 165 | "dependsOn": [ 166 | "[resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName'))]", 167 | "[resourceId('Microsoft.Resources/deploymentScripts', variables('name_deploymentScriptName'))]" 168 | ] 169 | } 170 | ], 171 | "outputs": { 172 | "Name": { 173 | "type": "string", 174 | "value": "[parameters('appName')]" 175 | }, 176 | "URL": { 177 | "type": "string", 178 | "value": "[reference(resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName')), '2023-05-01-preview').url]" 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /initial/mvnw.cmd: -------------------------------------------------------------------------------- 1 | <# : batch portion 2 | @REM ---------------------------------------------------------------------------- 3 | @REM Licensed to the Apache Software Foundation (ASF) under one 4 | @REM or more contributor license agreements. See the NOTICE file 5 | @REM distributed with this work for additional information 6 | @REM regarding copyright ownership. The ASF licenses this file 7 | @REM to you under the Apache License, Version 2.0 (the 8 | @REM "License"); you may not use this file except in compliance 9 | @REM with the License. You may obtain a copy of the License at 10 | @REM 11 | @REM http://www.apache.org/licenses/LICENSE-2.0 12 | @REM 13 | @REM Unless required by applicable law or agreed to in writing, 14 | @REM software distributed under the License is distributed on an 15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | @REM KIND, either express or implied. See the License for the 17 | @REM specific language governing permissions and limitations 18 | @REM under the License. 19 | @REM ---------------------------------------------------------------------------- 20 | 21 | @REM ---------------------------------------------------------------------------- 22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2 23 | @REM 24 | @REM Optional ENV vars 25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution 26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output 28 | @REM ---------------------------------------------------------------------------- 29 | 30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) 31 | @SET __MVNW_CMD__= 32 | @SET __MVNW_ERROR__= 33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% 34 | @SET PSModulePath= 35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( 36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) 37 | ) 38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% 39 | @SET __MVNW_PSMODULEP_SAVE= 40 | @SET __MVNW_ARG0_NAME__= 41 | @SET MVNW_USERNAME= 42 | @SET MVNW_PASSWORD= 43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) 44 | @echo Cannot start maven from wrapper >&2 && exit /b 1 45 | @GOTO :EOF 46 | : end batch / begin powershell #> 47 | 48 | $ErrorActionPreference = "Stop" 49 | if ($env:MVNW_VERBOSE -eq "true") { 50 | $VerbosePreference = "Continue" 51 | } 52 | 53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties 54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl 55 | if (!$distributionUrl) { 56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 57 | } 58 | 59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { 60 | "maven-mvnd-*" { 61 | $USE_MVND = $true 62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" 63 | $MVN_CMD = "mvnd.cmd" 64 | break 65 | } 66 | default { 67 | $USE_MVND = $false 68 | $MVN_CMD = $script -replace '^mvnw','mvn' 69 | break 70 | } 71 | } 72 | 73 | # apply MVNW_REPOURL and calculate MAVEN_HOME 74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 75 | if ($env:MVNW_REPOURL) { 76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } 77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" 78 | } 79 | $distributionUrlName = $distributionUrl -replace '^.*/','' 80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' 81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" 82 | if ($env:MAVEN_USER_HOME) { 83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" 84 | } 85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' 86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" 87 | 88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { 89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" 90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 91 | exit $? 92 | } 93 | 94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { 95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" 96 | } 97 | 98 | # prepare tmp dir 99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile 100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" 101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null 102 | trap { 103 | if ($TMP_DOWNLOAD_DIR.Exists) { 104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 106 | } 107 | } 108 | 109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null 110 | 111 | # Download and Install Apache Maven 112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 113 | Write-Verbose "Downloading from: $distributionUrl" 114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 115 | 116 | $webclient = New-Object System.Net.WebClient 117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { 118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) 119 | } 120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null 122 | 123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum 125 | if ($distributionSha256Sum) { 126 | if ($USE_MVND) { 127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." 128 | } 129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash 130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { 131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." 132 | } 133 | } 134 | 135 | # unzip and move 136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null 137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null 138 | try { 139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null 140 | } catch { 141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { 142 | Write-Error "fail to move MAVEN_HOME" 143 | } 144 | } finally { 145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 147 | } 148 | 149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 150 | -------------------------------------------------------------------------------- /complete/mvnw.cmd: -------------------------------------------------------------------------------- 1 | <# : batch portion 2 | @REM ---------------------------------------------------------------------------- 3 | @REM Licensed to the Apache Software Foundation (ASF) under one 4 | @REM or more contributor license agreements. See the NOTICE file 5 | @REM distributed with this work for additional information 6 | @REM regarding copyright ownership. The ASF licenses this file 7 | @REM to you under the Apache License, Version 2.0 (the 8 | @REM "License"); you may not use this file except in compliance 9 | @REM with the License. You may obtain a copy of the License at 10 | @REM 11 | @REM http://www.apache.org/licenses/LICENSE-2.0 12 | @REM 13 | @REM Unless required by applicable law or agreed to in writing, 14 | @REM software distributed under the License is distributed on an 15 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | @REM KIND, either express or implied. See the License for the 17 | @REM specific language governing permissions and limitations 18 | @REM under the License. 19 | @REM ---------------------------------------------------------------------------- 20 | 21 | @REM ---------------------------------------------------------------------------- 22 | @REM Apache Maven Wrapper startup batch script, version 3.3.2 23 | @REM 24 | @REM Optional ENV vars 25 | @REM MVNW_REPOURL - repo url base for downloading maven distribution 26 | @REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 27 | @REM MVNW_VERBOSE - true: enable verbose log; others: silence the output 28 | @REM ---------------------------------------------------------------------------- 29 | 30 | @IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) 31 | @SET __MVNW_CMD__= 32 | @SET __MVNW_ERROR__= 33 | @SET __MVNW_PSMODULEP_SAVE=%PSModulePath% 34 | @SET PSModulePath= 35 | @FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( 36 | IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) 37 | ) 38 | @SET PSModulePath=%__MVNW_PSMODULEP_SAVE% 39 | @SET __MVNW_PSMODULEP_SAVE= 40 | @SET __MVNW_ARG0_NAME__= 41 | @SET MVNW_USERNAME= 42 | @SET MVNW_PASSWORD= 43 | @IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) 44 | @echo Cannot start maven from wrapper >&2 && exit /b 1 45 | @GOTO :EOF 46 | : end batch / begin powershell #> 47 | 48 | $ErrorActionPreference = "Stop" 49 | if ($env:MVNW_VERBOSE -eq "true") { 50 | $VerbosePreference = "Continue" 51 | } 52 | 53 | # calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties 54 | $distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl 55 | if (!$distributionUrl) { 56 | Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" 57 | } 58 | 59 | switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { 60 | "maven-mvnd-*" { 61 | $USE_MVND = $true 62 | $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" 63 | $MVN_CMD = "mvnd.cmd" 64 | break 65 | } 66 | default { 67 | $USE_MVND = $false 68 | $MVN_CMD = $script -replace '^mvnw','mvn' 69 | break 70 | } 71 | } 72 | 73 | # apply MVNW_REPOURL and calculate MAVEN_HOME 74 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 75 | if ($env:MVNW_REPOURL) { 76 | $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } 77 | $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" 78 | } 79 | $distributionUrlName = $distributionUrl -replace '^.*/','' 80 | $distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' 81 | $MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" 82 | if ($env:MAVEN_USER_HOME) { 83 | $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" 84 | } 85 | $MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' 86 | $MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" 87 | 88 | if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { 89 | Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" 90 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 91 | exit $? 92 | } 93 | 94 | if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { 95 | Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" 96 | } 97 | 98 | # prepare tmp dir 99 | $TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile 100 | $TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" 101 | $TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null 102 | trap { 103 | if ($TMP_DOWNLOAD_DIR.Exists) { 104 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 105 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 106 | } 107 | } 108 | 109 | New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null 110 | 111 | # Download and Install Apache Maven 112 | Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 113 | Write-Verbose "Downloading from: $distributionUrl" 114 | Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 115 | 116 | $webclient = New-Object System.Net.WebClient 117 | if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { 118 | $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) 119 | } 120 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 121 | $webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null 122 | 123 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 124 | $distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum 125 | if ($distributionSha256Sum) { 126 | if ($USE_MVND) { 127 | Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." 128 | } 129 | Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash 130 | if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { 131 | Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." 132 | } 133 | } 134 | 135 | # unzip and move 136 | Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null 137 | Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null 138 | try { 139 | Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null 140 | } catch { 141 | if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { 142 | Write-Error "fail to move MAVEN_HOME" 143 | } 144 | } finally { 145 | try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } 146 | catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } 147 | } 148 | 149 | Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" 150 | -------------------------------------------------------------------------------- /complete/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /initial/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 147 | # shellcheck disable=SC3045 148 | MAX_FD=$( ulimit -H -n ) || 149 | warn "Could not query maximum file descriptor limit" 150 | esac 151 | case $MAX_FD in #( 152 | '' | soft) :;; #( 153 | *) 154 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 155 | # shellcheck disable=SC3045 156 | ulimit -n "$MAX_FD" || 157 | warn "Could not set maximum file descriptor limit to $MAX_FD" 158 | esac 159 | fi 160 | 161 | # Collect all arguments for the java command, stacking in reverse order: 162 | # * args from the command line 163 | # * the main class name 164 | # * -classpath 165 | # * -D...appname settings 166 | # * --module-path (only if needed) 167 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 168 | 169 | # For Cygwin or MSYS, switch paths to Windows format before running java 170 | if "$cygwin" || "$msys" ; then 171 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 172 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 173 | 174 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 175 | 176 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 177 | for arg do 178 | if 179 | case $arg in #( 180 | -*) false ;; # don't mess with options #( 181 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 182 | [ -e "$t" ] ;; #( 183 | *) false ;; 184 | esac 185 | then 186 | arg=$( cygpath --path --ignore --mixed "$arg" ) 187 | fi 188 | # Roll the args list around exactly as many times as the number of 189 | # args, so each arg winds up back in the position where it started, but 190 | # possibly modified. 191 | # 192 | # NB: a `for` loop captures its iteration list before it begins, so 193 | # changing the positional parameters here affects neither the number of 194 | # iterations, nor the values presented in `arg`. 195 | shift # remove old arg 196 | set -- "$@" "$arg" # push replacement arg 197 | done 198 | fi 199 | 200 | # Collect all arguments for the java command; 201 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 202 | # shell script including quotes and variable substitutions, so put them in 203 | # double quotes to make sure that they get re-expanded; and 204 | # * put everything else in single quotes, so that it's not re-expanded. 205 | 206 | set -- \ 207 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 208 | -classpath "$CLASSPATH" \ 209 | org.gradle.wrapper.GradleWrapperMain \ 210 | "$@" 211 | 212 | # Stop when "xargs" is not available. 213 | if ! command -v xargs >/dev/null 2>&1 214 | then 215 | die "xargs is not available" 216 | fi 217 | 218 | # Use "xargs" to parse quoted args. 219 | # 220 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 221 | # 222 | # In Bash we could simply go: 223 | # 224 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 225 | # set -- "${ARGS[@]}" "$@" 226 | # 227 | # but POSIX shell has neither arrays nor command substitution, so instead we 228 | # post-process each arg (as a line of input to sed) to backslash-escape any 229 | # character that might be a shell metacharacter, then use eval to reverse 230 | # that process (while maintaining the separation between arguments), and wrap 231 | # the whole thing up as a single "set" statement. 232 | # 233 | # This will of course break if any of these variables contains a newline or 234 | # an unmatched quote. 235 | # 236 | 237 | eval "set -- $( 238 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 239 | xargs -n1 | 240 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 241 | tr '\n' ' ' 242 | )" '"$@"' 243 | 244 | exec "$JAVACMD" "$@" 245 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- 1 | :toc: 2 | :icons: font 3 | :source-highlighter: prettify 4 | :project_id: gs-spring-boot-for-azure 5 | 6 | Before delving into the step-by-step execution of the application, you can simply click the Deploy to Azure button. This will instantly deploy the app to Azure Spring Apps. 7 | 8 | |=== 9 | |Deploy to Azure Spring Apps | 10 | |Consumption plan 11 | |image:https://aka.ms/deploytoazurebutton[link=https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fspring-guides%2Fgs-spring-boot-for-azure%2Fmain%2Finfra%2Fazuredeploy-asa-consumption.json] 12 | 13 | |Basic/Standard plan 14 | |image:https://aka.ms/deploytoazurebutton[link=https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fspring-guides%2Fgs-spring-boot-for-azure%2Fmain%2Finfra%2Fazuredeploy-asa-standard.json] 15 | 16 | |Enterprise plan 17 | |image:https://aka.ms/deploytoazurebutton[link=https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fspring-guides%2Fgs-spring-boot-for-azure%2Fmain%2Finfra%2Fazuredeploy-asa-enterprise.json] 18 | |=== 19 | 20 | This article walks you through deploying a Spring Boot application to https://learn.microsoft.com/azure/spring-apps/overview[Azure Spring Apps]. 21 | 22 | IMPORTANT: You are recommended to check out https://learn.microsoft.com/azure/spring-apps/quickstart[Azure Spring Apps quick start doc] for the latest instructions for the same task. 23 | 24 | == What you'll build 25 | 26 | You'll clone a sample Spring Boot application from GitHub and then use Maven to deploy it to Azure Spring Apps. 27 | 28 | == What you'll need 29 | 30 | The following prerequisites are required in order to follow the steps in this article: 31 | 32 | * An Azure subscription. If you don't have an Azure subscription, you can sign up for a https://azure.microsoft.com/pricing/free-trial/[free Azure account] or activate your https://azure.microsoft.com/pricing/member-offers/msdn-benefits-details/[MSDN subscriber benefits]. 33 | * An http://www.oracle.com/technetwork/java/javase/downloads/[Java Development Kit (JDK)], version 17 or later. 34 | * A https://github.com/[Git] client. 35 | 36 | == Build and run the web app locally 37 | 38 | In this section, you will clone a Spring Boot application and test it locally. 39 | 40 | . Open a terminal window. 41 | . Create a local directory to hold your Spring Boot application by typing `mkdir SpringBoot` 42 | . Change to that directory by typing `cd SpringBoot`. 43 | . Clone the https://github.com/spring-guides/gs-spring-boot-for-azure[Deploying a Spring Boot app to Azure] sample project into the directory you created by typing `git clone https://github.com/spring-guides/gs-spring-boot-for-azure` 44 | . Change to the directory of the completed project by typing `cd gs-spring-boot-for-azure/complete` 45 | . Build the JAR file using Maven by typing `./mvnw clean package` 46 | . When the web app has been created, start it by typing `./mvnw spring-boot:run` 47 | . Test it locally by either visiting http://localhost:8080 or typing `curl http://localhost:8080` from another terminal window. 48 | . You should see the following message displayed: *Hello World*. 49 | 50 | == Config and deploy the app to Azure Spring Apps 51 | 52 | === Provision an Azure Spring Apps instance 53 | 54 | . In a web browser, open the https://portal.azure.com/[Azure portal], and sign in to your account. 55 | . Search for `Azure Spring Apps` and then select `Azure Spring Apps`. 56 | . On the overview page, select Create, and then do the following: 57 | a. In the Service Name box, specify the name of your service instance. The name must be from 4 to 32 characters long and can contain only lowercase letters, numbers, and hyphens. The first character of the service name must be a letter, and the last character must be either a letter or a number. 58 | b. In the Subscription drop-down list, select the subscription you want to be billed for this resource. 59 | c. In the Resource group box, create a new resource group. Creating resource groups for new resources is a best practice. 60 | d. In the Location drop-down list, select the location for your service instance. 61 | . It takes about 5 minutes for the service to be deployed. 62 | 63 | === Add configuration for deployment 64 | 65 | . Config the web app with https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-spring-apps-maven-plugin[Maven Plugin for Azure Spring Apps] by this command: 66 | + 67 | ---- 68 | export MAVEN_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED" 69 | ./mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.18.0:config -DadvancedOptions 70 | ---- 71 | + 72 | - Command explanation: 73 | * `export MAVEN_OPTS="--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED"` is used to avoid the problem tracked in https://github.com/microsoft/azure-maven-plugins/issues/2222[azure-maven-plugins#2222]. 74 | * This maven goal will first authenticate with Azure, if you have logged in with https://docs.microsoft.com/en-us/cli/azure/[Azure CLI], it will consume its existing authentication token. Otherwise, it will get you logged in with https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Maven-Plugin/[azure-maven-plugin] automatically. 75 | 76 | - Input necessary information: 77 | * Select subscription: Select the subscription which host the Azure Spring Apps you just created. 78 | * Select Azure Spring Apps for deployment: Select the Azure Spring Apps you just created. 79 | * Input runtime Java version(Java 11): Java 17 80 | * Expose public access for this app boot-for-azure? (y/N): y 81 | * For other options, just select the default value. 82 | - Here is a sample terminal output: 83 | + 84 | ---- 85 | ~@Azure:~/gs-spring-boot/complete$ ./mvnw com.microsoft.azure:azure-spring-apps-maven-plugin:1.14.0:config -DadvancedOptions 86 | [INFO] Scanning for projects... 87 | [INFO] 88 | [INFO] ------------------------------------------------------------------------ 89 | [INFO] Building boot-for-azure 0.0.1-SNAPSHOT 90 | [INFO] ------------------------------------------------------------------------ 91 | [INFO] 92 | [INFO] --- azure-spring-apps-maven-plugin:1.14.0:config (default-cli) @ demo --- 93 | ... 94 | Available subscription: 95 | 1. xxx 96 | ... 97 | Select subscription [1-105] (20): 98 | ... 99 | Available Azure Spring Apps: 100 | 1. xxx 101 | ... 102 | Select Azure Spring Apps for deployment: [1-28] (1): 1 103 | [INFO] Using Azure Spring Apps: xxx 104 | Input the app name (demo): 105 | Expose public access for this app boot-for-azure? (y/N):y 106 | Summary of properties: 107 | Subscription id : xxx 108 | Resource group name : xxx 109 | Azure Spring Apps name : xxx 110 | App name : demo 111 | Public access : yes 112 | Instance count : 1 113 | CPU count : 1 114 | Memory size(GB) : 1 115 | Runtime Java version : Java 17 116 | Confirm to save all the above configurations (Y/n):Y 117 | ---- 118 | + 119 | . Optionally, open the *pom.xml* to see the new added content. 120 | + 121 | ---- 122 | 123 | com.microsoft.azure 124 | azure-spring-apps-maven-plugin 125 | 1.14.0 126 | 127 | xxx 128 | xxx 129 | xxx 130 | demo 131 | true 132 | 133 | 1 134 | 1 135 | 1 136 | Java 17 137 | 138 | 139 | 140 | 141 | 142 | ${project.basedir}/target 143 | 144 | *.jar 145 | 146 | 147 | 148 | 149 | 150 | 151 | ---- 152 | 153 | === Deploy the app 154 | 155 | . Run this command to deploy the app: 156 | + 157 | ---- 158 | ./mvnw azure-spring-apps:deploy 159 | ---- 160 | + 161 | . It might take a few minutes to deploy. After deploy finished, there will be a URL shown in the output. Navigate to the URL in a web browser. You should see the message displayed: `Hello World`. 162 | 163 | == Summary 164 | 165 | Congratulations! You built and deployed a Spring Boot app to Azure Spring Apps. You can visit the https://portal.azure.com/[Azure portal] to manage it. 166 | 167 | IMPORTANT: Don't forget to delete the Azure resources created if no longer needed. 168 | 169 | == Run with AZD 170 | You can also use https://learn.microsoft.com/azure/developer/azure-developer-cli/overview[the Azure Developer CLI (azd)] to quickly run this application on Azure Spring Apps. The Azure Developer CLI is an open-source tool that accelerates the time it takes for you to get your application from your local development environment to Azure. 171 | 172 | For how to run it with azd, you can refer to https://learn.microsoft.com/azure/spring-apps/quickstart[Deploy your first application to Azure Spring Apps] 173 | 174 | == See also 175 | 176 | Additional information about using Spring with Azure is available here: 177 | 178 | * https://learn.microsoft.com/azure/developer/java/spring/[Spring on Azure] 179 | * https://learn.microsoft.com/azure/developer/java/spring-framework/[Spring Cloud Azure] 180 | 181 | include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/main/footer.adoc[] 182 | -------------------------------------------------------------------------------- /initial/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.3.2 23 | # 24 | # Optional ENV vars 25 | # ----------------- 26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source 27 | # MVNW_REPOURL - repo url base for downloading maven distribution 28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output 30 | # ---------------------------------------------------------------------------- 31 | 32 | set -euf 33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x 34 | 35 | # OS specific support. 36 | native_path() { printf %s\\n "$1"; } 37 | case "$(uname)" in 38 | CYGWIN* | MINGW*) 39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" 40 | native_path() { cygpath --path --windows "$1"; } 41 | ;; 42 | esac 43 | 44 | # set JAVACMD and JAVACCMD 45 | set_java_home() { 46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched 47 | if [ -n "${JAVA_HOME-}" ]; then 48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 49 | # IBM's JDK on AIX uses strange locations for the executables 50 | JAVACMD="$JAVA_HOME/jre/sh/java" 51 | JAVACCMD="$JAVA_HOME/jre/sh/javac" 52 | else 53 | JAVACMD="$JAVA_HOME/bin/java" 54 | JAVACCMD="$JAVA_HOME/bin/javac" 55 | 56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then 57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 59 | return 1 60 | fi 61 | fi 62 | else 63 | JAVACMD="$( 64 | 'set' +e 65 | 'unset' -f command 2>/dev/null 66 | 'command' -v java 67 | )" || : 68 | JAVACCMD="$( 69 | 'set' +e 70 | 'unset' -f command 2>/dev/null 71 | 'command' -v javac 72 | )" || : 73 | 74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then 75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 76 | return 1 77 | fi 78 | fi 79 | } 80 | 81 | # hash string like Java String::hashCode 82 | hash_string() { 83 | str="${1:-}" h=0 84 | while [ -n "$str" ]; do 85 | char="${str%"${str#?}"}" 86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) 87 | str="${str#?}" 88 | done 89 | printf %x\\n $h 90 | } 91 | 92 | verbose() { :; } 93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } 94 | 95 | die() { 96 | printf %s\\n "$1" >&2 97 | exit 1 98 | } 99 | 100 | trim() { 101 | # MWRAPPER-139: 102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. 103 | # Needed for removing poorly interpreted newline sequences when running in more 104 | # exotic environments such as mingw bash on Windows. 105 | printf "%s" "${1}" | tr -d '[:space:]' 106 | } 107 | 108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties 109 | while IFS="=" read -r key value; do 110 | case "${key-}" in 111 | distributionUrl) distributionUrl=$(trim "${value-}") ;; 112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; 113 | esac 114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" 115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" 116 | 117 | case "${distributionUrl##*/}" in 118 | maven-mvnd-*bin.*) 119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ 120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in 121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; 122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; 123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; 124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; 125 | *) 126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 127 | distributionPlatform=linux-amd64 128 | ;; 129 | esac 130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" 131 | ;; 132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; 133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; 134 | esac 135 | 136 | # apply MVNW_REPOURL and calculate MAVEN_HOME 137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" 139 | distributionUrlName="${distributionUrl##*/}" 140 | distributionUrlNameMain="${distributionUrlName%.*}" 141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}" 142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" 143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" 144 | 145 | exec_maven() { 146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : 147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" 148 | } 149 | 150 | if [ -d "$MAVEN_HOME" ]; then 151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME" 152 | exec_maven "$@" 153 | fi 154 | 155 | case "${distributionUrl-}" in 156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; 157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; 158 | esac 159 | 160 | # prepare tmp dir 161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then 162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } 163 | trap clean HUP INT TERM EXIT 164 | else 165 | die "cannot create temp dir" 166 | fi 167 | 168 | mkdir -p -- "${MAVEN_HOME%/*}" 169 | 170 | # Download and Install Apache Maven 171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 172 | verbose "Downloading from: $distributionUrl" 173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 174 | 175 | # select .zip or .tar.gz 176 | if ! command -v unzip >/dev/null; then 177 | distributionUrl="${distributionUrl%.zip}.tar.gz" 178 | distributionUrlName="${distributionUrl##*/}" 179 | fi 180 | 181 | # verbose opt 182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' 183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v 184 | 185 | # normalize http auth 186 | case "${MVNW_PASSWORD:+has-password}" in 187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; 188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; 189 | esac 190 | 191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then 192 | verbose "Found wget ... using wget" 193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" 194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then 195 | verbose "Found curl ... using curl" 196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" 197 | elif set_java_home; then 198 | verbose "Falling back to use Java to download" 199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" 200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" 201 | cat >"$javaSource" <<-END 202 | public class Downloader extends java.net.Authenticator 203 | { 204 | protected java.net.PasswordAuthentication getPasswordAuthentication() 205 | { 206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); 207 | } 208 | public static void main( String[] args ) throws Exception 209 | { 210 | setDefault( new Downloader() ); 211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); 212 | } 213 | } 214 | END 215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java 216 | verbose " - Compiling Downloader.java ..." 217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" 218 | verbose " - Running Downloader.java ..." 219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" 220 | fi 221 | 222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 223 | if [ -n "${distributionSha256Sum-}" ]; then 224 | distributionSha256Result=false 225 | if [ "$MVN_CMD" = mvnd.sh ]; then 226 | echo "Checksum validation is not supported for maven-mvnd." >&2 227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 228 | exit 1 229 | elif command -v sha256sum >/dev/null; then 230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then 231 | distributionSha256Result=true 232 | fi 233 | elif command -v shasum >/dev/null; then 234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then 235 | distributionSha256Result=true 236 | fi 237 | else 238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 240 | exit 1 241 | fi 242 | if [ $distributionSha256Result = false ]; then 243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 245 | exit 1 246 | fi 247 | fi 248 | 249 | # unzip and move 250 | if command -v unzip >/dev/null; then 251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" 252 | else 253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" 254 | fi 255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" 256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" 257 | 258 | clean || : 259 | exec_maven "$@" 260 | -------------------------------------------------------------------------------- /complete/mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Apache Maven Wrapper startup batch script, version 3.3.2 23 | # 24 | # Optional ENV vars 25 | # ----------------- 26 | # JAVA_HOME - location of a JDK home dir, required when download maven via java source 27 | # MVNW_REPOURL - repo url base for downloading maven distribution 28 | # MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven 29 | # MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output 30 | # ---------------------------------------------------------------------------- 31 | 32 | set -euf 33 | [ "${MVNW_VERBOSE-}" != debug ] || set -x 34 | 35 | # OS specific support. 36 | native_path() { printf %s\\n "$1"; } 37 | case "$(uname)" in 38 | CYGWIN* | MINGW*) 39 | [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" 40 | native_path() { cygpath --path --windows "$1"; } 41 | ;; 42 | esac 43 | 44 | # set JAVACMD and JAVACCMD 45 | set_java_home() { 46 | # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched 47 | if [ -n "${JAVA_HOME-}" ]; then 48 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 49 | # IBM's JDK on AIX uses strange locations for the executables 50 | JAVACMD="$JAVA_HOME/jre/sh/java" 51 | JAVACCMD="$JAVA_HOME/jre/sh/javac" 52 | else 53 | JAVACMD="$JAVA_HOME/bin/java" 54 | JAVACCMD="$JAVA_HOME/bin/javac" 55 | 56 | if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then 57 | echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 58 | echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 59 | return 1 60 | fi 61 | fi 62 | else 63 | JAVACMD="$( 64 | 'set' +e 65 | 'unset' -f command 2>/dev/null 66 | 'command' -v java 67 | )" || : 68 | JAVACCMD="$( 69 | 'set' +e 70 | 'unset' -f command 2>/dev/null 71 | 'command' -v javac 72 | )" || : 73 | 74 | if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then 75 | echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 76 | return 1 77 | fi 78 | fi 79 | } 80 | 81 | # hash string like Java String::hashCode 82 | hash_string() { 83 | str="${1:-}" h=0 84 | while [ -n "$str" ]; do 85 | char="${str%"${str#?}"}" 86 | h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) 87 | str="${str#?}" 88 | done 89 | printf %x\\n $h 90 | } 91 | 92 | verbose() { :; } 93 | [ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } 94 | 95 | die() { 96 | printf %s\\n "$1" >&2 97 | exit 1 98 | } 99 | 100 | trim() { 101 | # MWRAPPER-139: 102 | # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. 103 | # Needed for removing poorly interpreted newline sequences when running in more 104 | # exotic environments such as mingw bash on Windows. 105 | printf "%s" "${1}" | tr -d '[:space:]' 106 | } 107 | 108 | # parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties 109 | while IFS="=" read -r key value; do 110 | case "${key-}" in 111 | distributionUrl) distributionUrl=$(trim "${value-}") ;; 112 | distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; 113 | esac 114 | done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" 115 | [ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" 116 | 117 | case "${distributionUrl##*/}" in 118 | maven-mvnd-*bin.*) 119 | MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ 120 | case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in 121 | *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; 122 | :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; 123 | :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; 124 | :Linux*x86_64*) distributionPlatform=linux-amd64 ;; 125 | *) 126 | echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 127 | distributionPlatform=linux-amd64 128 | ;; 129 | esac 130 | distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" 131 | ;; 132 | maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; 133 | *) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; 134 | esac 135 | 136 | # apply MVNW_REPOURL and calculate MAVEN_HOME 137 | # maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ 138 | [ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" 139 | distributionUrlName="${distributionUrl##*/}" 140 | distributionUrlNameMain="${distributionUrlName%.*}" 141 | distributionUrlNameMain="${distributionUrlNameMain%-bin}" 142 | MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" 143 | MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" 144 | 145 | exec_maven() { 146 | unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : 147 | exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" 148 | } 149 | 150 | if [ -d "$MAVEN_HOME" ]; then 151 | verbose "found existing MAVEN_HOME at $MAVEN_HOME" 152 | exec_maven "$@" 153 | fi 154 | 155 | case "${distributionUrl-}" in 156 | *?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; 157 | *) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; 158 | esac 159 | 160 | # prepare tmp dir 161 | if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then 162 | clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } 163 | trap clean HUP INT TERM EXIT 164 | else 165 | die "cannot create temp dir" 166 | fi 167 | 168 | mkdir -p -- "${MAVEN_HOME%/*}" 169 | 170 | # Download and Install Apache Maven 171 | verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." 172 | verbose "Downloading from: $distributionUrl" 173 | verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" 174 | 175 | # select .zip or .tar.gz 176 | if ! command -v unzip >/dev/null; then 177 | distributionUrl="${distributionUrl%.zip}.tar.gz" 178 | distributionUrlName="${distributionUrl##*/}" 179 | fi 180 | 181 | # verbose opt 182 | __MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' 183 | [ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v 184 | 185 | # normalize http auth 186 | case "${MVNW_PASSWORD:+has-password}" in 187 | '') MVNW_USERNAME='' MVNW_PASSWORD='' ;; 188 | has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; 189 | esac 190 | 191 | if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then 192 | verbose "Found wget ... using wget" 193 | wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" 194 | elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then 195 | verbose "Found curl ... using curl" 196 | curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" 197 | elif set_java_home; then 198 | verbose "Falling back to use Java to download" 199 | javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" 200 | targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" 201 | cat >"$javaSource" <<-END 202 | public class Downloader extends java.net.Authenticator 203 | { 204 | protected java.net.PasswordAuthentication getPasswordAuthentication() 205 | { 206 | return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); 207 | } 208 | public static void main( String[] args ) throws Exception 209 | { 210 | setDefault( new Downloader() ); 211 | java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); 212 | } 213 | } 214 | END 215 | # For Cygwin/MinGW, switch paths to Windows format before running javac and java 216 | verbose " - Compiling Downloader.java ..." 217 | "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" 218 | verbose " - Running Downloader.java ..." 219 | "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" 220 | fi 221 | 222 | # If specified, validate the SHA-256 sum of the Maven distribution zip file 223 | if [ -n "${distributionSha256Sum-}" ]; then 224 | distributionSha256Result=false 225 | if [ "$MVN_CMD" = mvnd.sh ]; then 226 | echo "Checksum validation is not supported for maven-mvnd." >&2 227 | echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 228 | exit 1 229 | elif command -v sha256sum >/dev/null; then 230 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then 231 | distributionSha256Result=true 232 | fi 233 | elif command -v shasum >/dev/null; then 234 | if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then 235 | distributionSha256Result=true 236 | fi 237 | else 238 | echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 239 | echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 240 | exit 1 241 | fi 242 | if [ $distributionSha256Result = false ]; then 243 | echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 244 | echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 245 | exit 1 246 | fi 247 | fi 248 | 249 | # unzip and move 250 | if command -v unzip >/dev/null; then 251 | unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" 252 | else 253 | tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" 254 | fi 255 | printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" 256 | mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" 257 | 258 | clean || : 259 | exec_maven "$@" 260 | -------------------------------------------------------------------------------- /infra/azuredeploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "plan": { 6 | "type": "string", 7 | "metadata": { 8 | "description": "Name of the pricing tier which determines the resource and cost associated with your instance." 9 | }, 10 | "allowedValues": [ 11 | "consumption", 12 | "standard", 13 | "enterprise" 14 | ], 15 | "defaultValue": "consumption" 16 | }, 17 | "location": { 18 | "type": "string", 19 | "metadata": { 20 | "description": "Primary location for all resources." 21 | }, 22 | "minLength": 1 23 | } 24 | }, 25 | "variables": { 26 | "$fxv#0": { 27 | "analysisServicesServers": "as", 28 | "apiManagementService": "apim-", 29 | "appConfigurationConfigurationStores": "appcs-", 30 | "appManagedEnvironments": "cae-", 31 | "appContainerApps": "ca-", 32 | "authorizationPolicyDefinitions": "policy-", 33 | "automationAutomationAccounts": "aa-", 34 | "blueprintBlueprints": "bp-", 35 | "blueprintBlueprintsArtifacts": "bpa-", 36 | "cacheRedis": "redis-", 37 | "cdnProfiles": "cdnp-", 38 | "cdnProfilesEndpoints": "cdne-", 39 | "cognitiveServicesAccounts": "cog-", 40 | "cognitiveServicesFormRecognizer": "cog-fr-", 41 | "cognitiveServicesTextAnalytics": "cog-ta-", 42 | "computeAvailabilitySets": "avail-", 43 | "computeCloudServices": "cld-", 44 | "computeDiskEncryptionSets": "des", 45 | "computeDisks": "disk", 46 | "computeDisksOs": "osdisk", 47 | "computeGalleries": "gal", 48 | "computeSnapshots": "snap-", 49 | "computeVirtualMachines": "vm", 50 | "computeVirtualMachineScaleSets": "vmss-", 51 | "containerInstanceContainerGroups": "ci", 52 | "containerRegistryRegistries": "cr", 53 | "containerServiceManagedClusters": "aks-", 54 | "databricksWorkspaces": "dbw-", 55 | "dataFactoryFactories": "adf-", 56 | "dataLakeAnalyticsAccounts": "dla", 57 | "dataLakeStoreAccounts": "dls", 58 | "dataMigrationServices": "dms-", 59 | "dBforMySQLServers": "mysql-", 60 | "dBforPostgreSQLServers": "psql-", 61 | "devicesIotHubs": "iot-", 62 | "devicesProvisioningServices": "provs-", 63 | "devicesProvisioningServicesCertificates": "pcert-", 64 | "documentDBDatabaseAccounts": "cosmos-", 65 | "eventGridDomains": "evgd-", 66 | "eventGridDomainsTopics": "evgt-", 67 | "eventGridEventSubscriptions": "evgs-", 68 | "eventHubNamespaces": "evhns-", 69 | "eventHubNamespacesEventHubs": "evh-", 70 | "hdInsightClustersHadoop": "hadoop-", 71 | "hdInsightClustersHbase": "hbase-", 72 | "hdInsightClustersKafka": "kafka-", 73 | "hdInsightClustersMl": "mls-", 74 | "hdInsightClustersSpark": "spark-", 75 | "hdInsightClustersStorm": "storm-", 76 | "hybridComputeMachines": "arcs-", 77 | "insightsActionGroups": "ag-", 78 | "insightsComponents": "appi-", 79 | "keyVaultVaults": "kv-", 80 | "kubernetesConnectedClusters": "arck", 81 | "kustoClusters": "dec", 82 | "kustoClustersDatabases": "dedb", 83 | "logicIntegrationAccounts": "ia-", 84 | "logicWorkflows": "logic-", 85 | "machineLearningServicesWorkspaces": "mlw-", 86 | "managedIdentityUserAssignedIdentities": "id-", 87 | "managementManagementGroups": "mg-", 88 | "migrateAssessmentProjects": "migr-", 89 | "networkApplicationGateways": "agw-", 90 | "networkApplicationSecurityGroups": "asg-", 91 | "networkAzureFirewalls": "afw-", 92 | "networkBastionHosts": "bas-", 93 | "networkConnections": "con-", 94 | "networkDnsZones": "dnsz-", 95 | "networkExpressRouteCircuits": "erc-", 96 | "networkFirewallPolicies": "afwp-", 97 | "networkFirewallPoliciesWebApplication": "waf", 98 | "networkFirewallPoliciesRuleGroups": "wafrg", 99 | "networkFrontDoors": "fd-", 100 | "networkFrontdoorWebApplicationFirewallPolicies": "fdfp-", 101 | "networkLoadBalancersExternal": "lbe-", 102 | "networkLoadBalancersInternal": "lbi-", 103 | "networkLoadBalancersInboundNatRules": "rule-", 104 | "networkLocalNetworkGateways": "lgw-", 105 | "networkNatGateways": "ng-", 106 | "networkNetworkInterfaces": "nic-", 107 | "networkNetworkSecurityGroups": "nsg-", 108 | "networkNetworkSecurityGroupsSecurityRules": "nsgsr-", 109 | "networkNetworkWatchers": "nw-", 110 | "networkPrivateDnsZones": "pdnsz-", 111 | "networkPrivateLinkServices": "pl-", 112 | "networkPublicIPAddresses": "pip-", 113 | "networkPublicIPPrefixes": "ippre-", 114 | "networkRouteFilters": "rf-", 115 | "networkRouteTables": "rt-", 116 | "networkRouteTablesRoutes": "udr-", 117 | "networkTrafficManagerProfiles": "traf-", 118 | "networkVirtualNetworkGateways": "vgw-", 119 | "networkVirtualNetworks": "vnet-", 120 | "networkVirtualNetworksSubnets": "snet-", 121 | "networkVirtualNetworksVirtualNetworkPeerings": "peer-", 122 | "networkVirtualWans": "vwan-", 123 | "networkVpnGateways": "vpng-", 124 | "networkVpnGatewaysVpnConnections": "vcn-", 125 | "networkVpnGatewaysVpnSites": "vst-", 126 | "notificationHubsNamespaces": "ntfns-", 127 | "notificationHubsNamespacesNotificationHubs": "ntf-", 128 | "operationalInsightsWorkspaces": "log-", 129 | "portalDashboards": "dash-", 130 | "powerBIDedicatedCapacities": "pbi-", 131 | "purviewAccounts": "pview-", 132 | "postgresServer": "pg-", 133 | "recoveryServicesVaults": "rsv-", 134 | "resourcesResourceGroups": "rg-", 135 | "searchSearchServices": "srch-", 136 | "serviceBusNamespaces": "sb-", 137 | "serviceBusNamespacesQueues": "sbq-", 138 | "serviceBusNamespacesTopics": "sbt-", 139 | "serviceEndPointPolicies": "se-", 140 | "serviceFabricClusters": "sf-", 141 | "signalRServiceSignalR": "sigr", 142 | "springApps": "asa-", 143 | "sqlManagedInstances": "sqlmi-", 144 | "sqlServers": "sql-", 145 | "sqlServersDataWarehouse": "sqldw-", 146 | "sqlServersDatabases": "sqldb-", 147 | "sqlServersDatabasesStretch": "sqlstrdb-", 148 | "storageStorageAccounts": "st", 149 | "storageStorageAccountsVm": "stvm", 150 | "storSimpleManagers": "ssimp", 151 | "streamAnalyticsCluster": "asa-", 152 | "synapseWorkspaces": "syn", 153 | "synapseWorkspacesAnalyticsWorkspaces": "synw", 154 | "synapseWorkspacesSqlPoolsDedicated": "syndp", 155 | "synapseWorkspacesSqlPoolsSpark": "synsp", 156 | "timeSeriesInsightsEnvironments": "tsi-", 157 | "webServerFarms": "plan-", 158 | "webSitesAppService": "app-", 159 | "webSitesAppServiceEnvironment": "ase-", 160 | "webSitesFunctions": "func-", 161 | "webStaticSites": "stapp-" 162 | }, 163 | "abbrs": "[variables('$fxv#0')]", 164 | "resourceToken": "[toLower(uniqueString(subscription().id, resourceGroup().name, parameters('location')))]", 165 | "asaInstanceName": "[format('{0}{1}', variables('abbrs').springApps, variables('resourceToken'))]", 166 | "appName": "demo", 167 | "userAssignedManagedIdentityName": "[format('{0}{1}', variables('abbrs').managedIdentityUserAssignedIdentities, variables('resourceToken'))]", 168 | "tags": { 169 | "spring-cloud-azure": "true", 170 | "deploy-to-azure-button": "true" 171 | } 172 | }, 173 | "resources": [ 174 | { 175 | "condition": "[equals(parameters('plan'), 'consumption')]", 176 | "type": "Microsoft.Resources/deployments", 177 | "apiVersion": "2022-09-01", 178 | "name": "[format('{0}--{1}', deployment().name, parameters('plan'))]", 179 | "properties": { 180 | "expressionEvaluationOptions": { 181 | "scope": "inner" 182 | }, 183 | "mode": "Incremental", 184 | "parameters": { 185 | "location": { 186 | "value": "[parameters('location')]" 187 | }, 188 | "appName": { 189 | "value": "[variables('appName')]" 190 | }, 191 | "tags": { 192 | "value": "[union(variables('tags'), createObject('asa-service-name', variables('appName')))]" 193 | }, 194 | "asaInstanceName": { 195 | "value": "[concat(variables('asaInstanceName'), '-', parameters('plan'))]" 196 | }, 197 | "userAssignedManagedIdentityName": { 198 | "value": "[concat(variables('userAssignedManagedIdentityName'), '-', parameters('plan'))]" 199 | } 200 | }, 201 | "templateLink": { 202 | "relativePath": "azuredeploy/consumption.json", 203 | "contentVersion":"1.0.0.0" 204 | } 205 | } 206 | }, 207 | { 208 | "condition": "[equals(parameters('plan'), 'standard')]", 209 | "type": "Microsoft.Resources/deployments", 210 | "apiVersion": "2022-09-01", 211 | "name": "[format('{0}--{1}', deployment().name, parameters('plan'))]", 212 | "properties": { 213 | "expressionEvaluationOptions": { 214 | "scope": "inner" 215 | }, 216 | "mode": "Incremental", 217 | "parameters": { 218 | "location": { 219 | "value": "[parameters('location')]" 220 | }, 221 | "appName": { 222 | "value": "[variables('appName')]" 223 | }, 224 | "tags": { 225 | "value": "[union(variables('tags'), createObject('asa-service-name', variables('appName')))]" 226 | }, 227 | "asaInstanceName": { 228 | "value": "[concat(variables('asaInstanceName'), '-', parameters('plan'))]" 229 | }, 230 | "userAssignedManagedIdentityName": { 231 | "value": "[concat(variables('userAssignedManagedIdentityName'), '-', parameters('plan'))]" 232 | } 233 | }, 234 | "templateLink": { 235 | "relativePath": "azuredeploy/standard.json", 236 | "contentVersion":"1.0.0.0" 237 | } 238 | } 239 | }, 240 | { 241 | "condition": "[equals(parameters('plan'), 'enterprise')]", 242 | "type": "Microsoft.Resources/deployments", 243 | "apiVersion": "2022-09-01", 244 | "name": "[format('{0}--{1}', deployment().name, parameters('plan'))]", 245 | "properties": { 246 | "expressionEvaluationOptions": { 247 | "scope": "inner" 248 | }, 249 | "mode": "Incremental", 250 | "parameters": { 251 | "location": { 252 | "value": "[parameters('location')]" 253 | }, 254 | "appName": { 255 | "value": "[variables('appName')]" 256 | }, 257 | "tags": { 258 | "value": "[union(variables('tags'), createObject('asa-service-name', variables('appName')))]" 259 | }, 260 | "asaInstanceName": { 261 | "value": "[concat(variables('asaInstanceName'), '-', parameters('plan'))]" 262 | }, 263 | "userAssignedManagedIdentityName": { 264 | "value": "[concat(variables('userAssignedManagedIdentityName'), '-', parameters('plan'))]" 265 | } 266 | }, 267 | "templateLink": { 268 | "relativePath": "azuredeploy/enterprise.json", 269 | "contentVersion":"1.0.0.0" 270 | } 271 | } 272 | } 273 | ], 274 | "outputs": { 275 | "Name": { 276 | "type": "string", 277 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--{1}', deployment().name, parameters('plan'))), '2022-09-01').outputs.Name.value]" 278 | }, 279 | "URL": { 280 | "type": "string", 281 | "value": "[reference(resourceId('Microsoft.Resources/deployments', format('{0}--{1}', deployment().name, parameters('plan'))), '2022-09-01').outputs.URL.value]" 282 | } 283 | } 284 | } 285 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | https://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "{}" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright {yyyy} {name of copyright owner} 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | https://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /infra/azuredeploy/enterprise.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", 3 | "contentVersion": "1.0.0.0", 4 | "parameters": { 5 | "asaInstanceName": { 6 | "type": "string" 7 | }, 8 | "appName": { 9 | "type": "string" 10 | }, 11 | "location": { 12 | "type": "string", 13 | "defaultValue": "[resourceGroup().location]" 14 | }, 15 | "tags": { 16 | "type": "object", 17 | "defaultValue": {} 18 | }, 19 | "userAssignedManagedIdentityName": { 20 | "type": "string" 21 | } 22 | }, 23 | "variables": { 24 | "const_ownerRole": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')]", 25 | "const_scriptLocation": "https://raw.githubusercontent.com/spring-guides/gs-spring-boot-for-azure/main/infra/azuredeploy/", 26 | "const_uploadScriptName": "deploy-jar-to-asa.sh", 27 | "const_checkScriptName": "check-provision-state.ps1", 28 | "const_checkingBuilderStateDeploymentName": "checking-build-service-builder-state", 29 | "ref_identityId": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 30 | "name_deploymentScriptName": "asa-enterprise-deployment-script", 31 | "name_roleAssignmentName": "[guid(format('{0}{1}Role assignment in group{0}', resourceGroup().name, variables('ref_identityId')))]" 32 | }, 33 | "resources": [ 34 | { 35 | "type": "Microsoft.AppPlatform/Spring", 36 | "apiVersion": "2023-05-01-preview", 37 | "name": "[parameters('asaInstanceName')]", 38 | "location": "[parameters('location')]", 39 | "tags": "[parameters('tags')]", 40 | "sku": { 41 | "name": "E0", 42 | "tier": "Enterprise" 43 | } 44 | }, 45 | { 46 | "type": "Microsoft.AppPlatform/Spring/applicationAccelerators", 47 | "apiVersion": "2023-05-01-preview", 48 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 49 | "dependsOn": [ 50 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 51 | ] 52 | }, 53 | { 54 | "type": "Microsoft.AppPlatform/Spring/applicationLiveViews", 55 | "apiVersion": "2023-05-01-preview", 56 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 57 | "dependsOn": [ 58 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 59 | ], 60 | "properties": {} 61 | }, 62 | { 63 | "type": "Microsoft.AppPlatform/Spring/apps", 64 | "apiVersion": "2023-05-01-preview", 65 | "name": "[format('{0}/{1}', parameters('asaInstanceName'), parameters('appName'))]", 66 | "location": "[parameters('location')]", 67 | "dependsOn": [ 68 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 69 | ], 70 | "properties": { 71 | "addonConfigs": { 72 | "applicationConfigurationService": {}, 73 | "serviceRegistry": {} 74 | }, 75 | "public": true, 76 | "httpsOnly": false, 77 | "temporaryDisk": { 78 | "sizeInGB": 5, 79 | "mountPath": "/tmp" 80 | }, 81 | "persistentDisk": { 82 | "sizeInGB": 0, 83 | "mountPath": "/persistent" 84 | }, 85 | "enableEndToEndTLS": false, 86 | "ingressSettings": { 87 | "readTimeoutInSeconds": 300, 88 | "sendTimeoutInSeconds": 60, 89 | "sessionCookieMaxAge": 0, 90 | "sessionAffinity": "None", 91 | "backendProtocol": "Default" 92 | } 93 | } 94 | }, 95 | { 96 | "type": "Microsoft.AppPlatform/Spring/buildServices", 97 | "apiVersion": "2023-05-01-preview", 98 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 99 | "dependsOn": [ 100 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 101 | ], 102 | "properties": { 103 | "resourceRequests": {} 104 | } 105 | }, 106 | { 107 | "type": "Microsoft.AppPlatform/Spring/configurationServices", 108 | "apiVersion": "2023-05-01-preview", 109 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 110 | "dependsOn": [ 111 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 112 | ], 113 | "properties": { 114 | "generation": "Gen1" 115 | } 116 | }, 117 | { 118 | "type": "Microsoft.AppPlatform/Spring/devToolPortals", 119 | "apiVersion": "2023-05-01-preview", 120 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 121 | "dependsOn": [ 122 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 123 | ], 124 | "properties": { 125 | "public": false, 126 | "features": { 127 | "applicationAccelerator": { 128 | "state": "Enabled" 129 | }, 130 | "applicationLiveView": { 131 | "state": "Enabled" 132 | } 133 | } 134 | } 135 | }, 136 | { 137 | "type": "Microsoft.AppPlatform/Spring/gateways", 138 | "apiVersion": "2023-05-01-preview", 139 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 140 | "dependsOn": [ 141 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 142 | ], 143 | "sku": { 144 | "name": "E0", 145 | "tier": "Enterprise", 146 | "capacity": 2 147 | }, 148 | "properties": { 149 | "public": false, 150 | "httpsOnly": false, 151 | "resourceRequests": { 152 | "cpu": "1", 153 | "memory": "2Gi" 154 | }, 155 | "clientAuth": { 156 | "certificateVerification": "Disabled" 157 | } 158 | } 159 | }, 160 | { 161 | "type": "Microsoft.AppPlatform/Spring/serviceRegistries", 162 | "apiVersion": "2023-05-01-preview", 163 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 164 | "dependsOn": [ 165 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 166 | ] 167 | }, 168 | { 169 | "type": "Microsoft.AppPlatform/Spring/apiPortals", 170 | "apiVersion": "2023-05-01-preview", 171 | "name": "[concat(parameters('asaInstanceName'), '/default')]", 172 | "dependsOn": [ 173 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]", 174 | "[resourceId('Microsoft.AppPlatform/Spring/gateways', parameters('asaInstanceName'), 'default')]" 175 | ], 176 | "sku": { 177 | "name": "E0", 178 | "tier": "Enterprise", 179 | "capacity": 1 180 | }, 181 | "properties": { 182 | "public": false, 183 | "httpsOnly": false, 184 | "gatewayIds": [ 185 | "[resourceId('Microsoft.AppPlatform/Spring/gateways', parameters('asaInstanceName'), 'default')]" 186 | ] 187 | } 188 | }, 189 | { 190 | "type": "Microsoft.ManagedIdentity/userAssignedIdentities", 191 | "name": "[parameters('userAssignedManagedIdentityName')]", 192 | "apiVersion": "2023-01-31", 193 | "location": "[parameters('location')]" 194 | }, 195 | { 196 | "type": "Microsoft.Authorization/roleAssignments", 197 | "apiVersion": "2022-04-01", 198 | "name": "[variables('name_roleAssignmentName')]", 199 | "dependsOn": [ 200 | "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName'))]", 201 | "[resourceId('Microsoft.AppPlatform/Spring', parameters('asaInstanceName'))]" 202 | ], 203 | "properties": { 204 | "roleDefinitionId": "[variables('const_ownerRole')]", 205 | "principalId": "[reference(variables('ref_identityId')).principalId]", 206 | "principalType": "ServicePrincipal", 207 | "scope": "[resourceGroup().id]" 208 | } 209 | }, 210 | { 211 | "type": "Microsoft.Resources/deploymentScripts", 212 | "apiVersion": "2020-10-01", 213 | "name": "[variables('const_checkingBuilderStateDeploymentName')]", 214 | "location": "[parameters('location')]", 215 | "dependsOn": [ 216 | "[resourceId('Microsoft.Authorization/roleAssignments', variables('name_roleAssignmentName'))]", 217 | "[resourceId('Microsoft.AppPlatform/Spring/apps/deployments', parameters('asaInstanceName'), parameters('appName'), 'default')]" 218 | ], 219 | "kind": "AzurePowerShell", 220 | "identity": { 221 | "type": "UserAssigned", 222 | "userAssignedIdentities": { 223 | "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName')))]": {} 224 | } 225 | }, 226 | "properties": { 227 | "azPowerShellVersion": "9.7", 228 | "primaryScriptUri": "[uri(variables('const_scriptLocation'), variables('const_checkScriptName'))]", 229 | "environmentVariables": [ 230 | { 231 | "name": "SUBSCRIPTION_ID", 232 | "value": "[subscription().subscriptionId]" 233 | }, 234 | { 235 | "name": "RESOURCE_GROUP", 236 | "value": "[resourceGroup().name]" 237 | }, 238 | { 239 | "name": "ASA_SERVICE_NAME", 240 | "value": "[parameters('asaInstanceName')]" 241 | } 242 | ], 243 | "cleanupPreference": "OnSuccess", 244 | "retentionInterval": "P1D" 245 | } 246 | }, 247 | { 248 | "type": "Microsoft.Resources/deploymentScripts", 249 | "apiVersion": "2020-10-01", 250 | "name": "[variables('name_deploymentScriptName')]", 251 | "location": "[parameters('location')]", 252 | "dependsOn": [ 253 | "[resourceId('Microsoft.Resources/deploymentScripts', variables('const_checkingBuilderStateDeploymentName'))]", 254 | "[resourceId('Microsoft.Authorization/roleAssignments', variables('name_roleAssignmentName'))]", 255 | "[resourceId('Microsoft.AppPlatform/Spring/apps/deployments', parameters('asaInstanceName'), parameters('appName'), 'default')]" 256 | ], 257 | "kind": "AzureCLI", 258 | "identity": { 259 | "type": "UserAssigned", 260 | "userAssignedIdentities": { 261 | "[format('{0}', resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', parameters('userAssignedManagedIdentityName')))]": {} 262 | } 263 | }, 264 | "properties": { 265 | "AzCliVersion": "2.41.0", 266 | "primaryScriptUri": "[uri(variables('const_scriptLocation'), variables('const_uploadScriptName'))]", 267 | "environmentVariables": [ 268 | { 269 | "name": "SUBSCRIPTION_ID", 270 | "value": "[subscription().subscriptionId]" 271 | }, 272 | { 273 | "name": "RESOURCE_GROUP", 274 | "value": "[resourceGroup().name]" 275 | }, 276 | { 277 | "name": "ASA_SERVICE_NAME", 278 | "value": "[parameters('asaInstanceName')]" 279 | } 280 | ], 281 | "cleanupPreference": "OnSuccess", 282 | "retentionInterval": "P1D" 283 | } 284 | }, 285 | { 286 | "type": "Microsoft.AppPlatform/Spring/apps/deployments", 287 | "apiVersion": "2023-05-01-preview", 288 | "name": "[format('{0}/{1}/{2}', parameters('asaInstanceName'), parameters('appName'), 'default')]", 289 | "dependsOn": [ 290 | "[resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName'))]" 291 | ], 292 | "properties": { 293 | "active": true, 294 | "deploymentSettings": { 295 | "resourceRequests": { 296 | "cpu": "1", 297 | "memory": "2Gi" 298 | } 299 | }, 300 | "source": { 301 | "type": "BuildResult", 302 | "buildResultId": "" 303 | } 304 | } 305 | }, 306 | { 307 | "type": "Microsoft.AppPlatform/Spring/buildServices/agentPools", 308 | "apiVersion": "2023-05-01-preview", 309 | "name": "[concat(parameters('asaInstanceName'), '/default/default')]", 310 | "dependsOn": [ 311 | "[resourceId('Microsoft.AppPlatform/Spring/buildServices', parameters('asaInstanceName'), 'default')]" 312 | ], 313 | "properties": { 314 | "poolSize": { 315 | "name": "S1" 316 | } 317 | } 318 | } 319 | ], 320 | "outputs": { 321 | "Name": { 322 | "type": "string", 323 | "value": "[parameters('appName')]" 324 | }, 325 | "URL": { 326 | "type": "string", 327 | "value": "[reference(resourceId('Microsoft.AppPlatform/Spring/apps', parameters('asaInstanceName'), parameters('appName')), '2023-05-01-preview').url]" 328 | } 329 | } 330 | } --------------------------------------------------------------------------------