Misc
Deleting a resource
The best way to delete a resource cleanly is to delete the resource group associated with that resource:
-
Go to Resource groups
-
Click the menu icon to the right of the resource group you’d like to delete > Delete resource group
App Service
Build process
The build process is run by Oryx
Oryx will build the application based on the detected language. See its documentation on how it detects and builds languages.
Deployment process
The deployment process is run by kudu
Deploying Java apps using Local Git
Local Git isn’t officially supported for Java apps. To get it working:
-
Create a
.deployment
file with this content:[config] command = bash deployment.sh
-
Create a
deployment.sh
file with this content:# Echo all commands in this script set -x # Install Java (the Azure App Service build runs using https://github.com/microsoft/Oryx) /opt/oryx/oryx prep -s "$DEPLOYMENT_SOURCE" 2>&1 # Gradle needs to know where Java is export JAVA_HOME=$(ls -d /tmp/oryx/platforms/java/*) # Clean any previous builds and build the jar file ./gradlew clean bootJar 2>&1 # Get the path to the app jar file APP_JAR=$(find build/ -name "*.jar" -not -name "*-plain.jar") # Copy the app jar file to /home/site/wwwroot/app.jar which will be run by default # (https://github.com/Azure-App-Service/java/blob/dbba8f05c433df825a06d7a27bbf5060b1c4d812/shared/init_container.sh#L146) cp "${DEPLOYMENT_SOURCE}/${APP_JAR}" "${DEPLOYMENT_TARGET}/app.jar"
Customize as needed, e.g. for Maven you might use this instead:
./mvnw clean package 2>&1 APP_JAR=$(find target/ -name "*.jar" -not -name "*-plain.jar")
You can also use the built-in Oryx build logic for Java by replacing the
oryx
line with this:/opt/oryx/oryx build --platform java --output "$DEPLOYMENT_TARGET" "$DEPLOYMENT_SOURCE" 2>&1
However, it seems to run
mvn clean compile
so you’ll still need to runmvn clean package
manually in order to generate the.jar
file.
Web apps
Create a new web app from a Github repo
-
Create a resource
-
Web > Web App
- Note: Don’t choose Web App for Containers. This will only allow you to deploy your app by creating and updating a container for the app itself
-
Once the app resource has been created, go to Deployment > Deployment options to set up a repository for automated deployments
-
Define any environment variables as desired (see below)
Set environment variables
-
Settings > Application settings > Application settings
-
Make sure to click Save when you’re done
Monitoring web app deployments from Github
Go to Deployment > Deployment options
SSH into web app container instance
View logs
-
Enable logging
-
Monitoring > Diagnostics logs
-
Docker Container logging > change it to something other than Off
-
Save
-
-
SSH into the container instance (see above)
-
Logs will be located in /home/LogFiles
- The log naming is inconsistent, but the log you want will be one of the more recent ones and should grow in size
VMs
Restrict access to a VM
-
Settings > Networking
-
Under Inbound port rules click on the specific entry you’d like to restrict
-
Change the Source as desired > Save