Create an Azure Spring Apps Enterprise service
As the first step, you will create an Azure Spring Apps Enterprise Service instance. You will use for this purpose Azure CLI. If you are interested in accomplishing this programmatically, review the Microsoft documentation that describes the provisioning process.
Step by step guidance
-
On your lab computer, open the Git Bash window and, from the Git Bash prompt, run the following command to sign in to your Azure subscription:
az login
In case you are running this lab in a GitHub codespace, use
az login --use-device-code
. -
Executing the command will automatically open a web browser window prompting you to authenticate. Once prompted, sign in using the user account that has the Owner role in the target Azure subscription that you will use in this lab and close the web browser window.
-
Make sure that you are logged in to the right subscription for the consecutive commands.
az account list -o table
-
If in the above statement you don’t see the right account being indicated as your default one, change your environment to the right subscription with the following command, replacing the
<subscription-id>
.az account set --subscription <subscription-id>
-
Run the following commands to create a resource group that will contain all of your resources (replace the
<azure-region>
placeholder with the name of any Azure region in which you can create an Enterprise SKU instance of the Azure Spring Apps service and an Azure Database for MySQL Flexible Server instance, see this page for regional availability details of those services):UNIQUEID=$(openssl rand -hex 3) APPNAME=petclinic RESOURCE_GROUP=rg-$APPNAME-$UNIQUEID LOCATION=<azure-region> az group create -g $RESOURCE_GROUP -l $LOCATION
-
Run the following command to add and upgrade the spring extension.
az extension add --upgrade --name spring
-
Make sure you don’t have the previous
spring-cloud
extension installed.az extension list az extension remove --name spring-cloud
-
Also register the
Microsoft.SaaS
provider. It might take some time for this provider to register, so check regularly with the second statement whether it indicates the provider is successfully installed before proceeding with the next statements.az provider register --namespace Microsoft.SaaS az provider show -n Microsoft.SaaS --query registrationState
-
Accept the license terms of the Spring Apps Enterprise tier.
az term accept \ --publisher vmware-inc \ --product azure-spring-cloud-vmware-tanzu-2 \ --plan asa-ent-hr-mtr
-
Run the following commands to create an instance of the enterprise SKU of the Azure Spring Apps service. Note that the name of the service needs to be globally unique, so adjust it accordingly in case the randomly generated name is already in use. Keep in mind that the name can contain only lowercase letters, numbers and hyphens.
SPRING_APPS_SERVICE=sa-$APPNAME-$UNIQUEID az spring create \ --resource-group $RESOURCE_GROUP \ --name $SPRING_APPS_SERVICE \ --sku enterprise \ --enable-application-configuration-service \ --enable-service-registry \ --enable-gateway \ --enable-api-portal
This will also create for you an Application Insights resource.
Wait for the provisioning to complete. This might take about 5 minutes.
-
Run the following command to set your default resource group name and Spring Apps service name. By setting these defaults, you don’t need to repeat these names in the subsequent commands.
az config set defaults.group=$RESOURCE_GROUP defaults.spring=$SPRING_APPS_SERVICE
-
Open a web browser window and navigate to the Azure portal. If prompted, sign in using the user account that has the Owner role in the target Azure subscription that you will use in this lab.
-
In the Azure portal, use the Search resources, services, and docs text box to search for and navigate to the resource group you just created.
-
On the resource group overview pane, verify that the resource group contains an Azure Spring Apps instance.
In case you don’t see the Azure Spring Apps service in the overview list of the resource group, select the Refresh toolbar button to refresh the view of the resource groups.
You will notice an Application Insights resource also was created in your resource group. You will use this in one of the next labs.
-
Select the Azure Spring Apps instance and, in the vertical navigation menu, in the Settings section, select Apps. Note that the instance does not include any spring apps at this point. You will perform the app deployment later in this exercise.