Create and deploy applications by using PowerShell

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.

This article applies to: ✔️ Basic/Standard ✔️ Enterprise

This article describes how you can create an instance of Azure Spring Apps by using the Az.SpringCloud PowerShell module.

Requirements

The requirements for completing the steps in this article depend on your Azure subscription:

  • If you don't have an Azure subscription, create a free account before you begin.

Important

While the Az.SpringCloud PowerShell module is in preview, you must install it by using the Install-Module cmdlet. See the following command. After this PowerShell module becomes generally available, it will be part of future Az PowerShell releases and available by default from within Azure Cloud Shell.

Install-Module -Name Az.SpringCloud
  • If you have multiple Azure subscriptions, choose the appropriate subscription in which the resources should be billed. Select a specific subscription by using the Set-AzContext cmdlet:

    Set-AzContext -SubscriptionId <subscription-ID>
    

Create a resource group

A resource group is a logical container in which Azure resources are deployed and managed as a group. Create an Azure resource group by using the New-AzResourceGroup cmdlet. The following example creates a resource group with a specified name and location.

New-AzResourceGroup -Name <resource group name> -Location eastus

Provision a new instance

To create a new instance of Azure Spring Apps, you use the New-AzSpringCloud cmdlet. The following example creates an Azure Spring Apps service, with the name that you specified in the resource group you created previously.

New-AzSpringCloud -ResourceGroupName <resource group name> -name <service instance name> -Location eastus

Create a new application

To create a new app, you use the New-AzSpringCloudApp cmdlet. The following example creates an app in Azure Spring Apps named gateway.

New-AzSpringCloudApp -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway

Create a new app deployment

To create a new app Deployment, you use the New-AzSpringCloudAppDeployment cmdlet. The following example creates an app deployment in Azure Spring Apps named default with an empty welcome application, for the gateway app.

$welcomeApplication = New-AzSpringCloudAppDeploymentJarUploadedObject -RuntimeVersion "Java_11"
New-AzSpringCloudAppDeployment -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway -Name default -Source $welcomeApplication

Get a service and its properties

To get an Azure Spring Apps service and its properties, you use the Get-AzSpringCloud cmdlet. The following example retrieves information about the specified Azure Spring Apps service.

Get-AzSpringCloud -ResourceGroupName <resource group name> -ServiceName <service instance name>

Get an application

To get an app and its properties in Azure Spring Apps, you use the Get-AzSpringCloudApp cmdlet. The following example retrieves information about the app gateway.

Get-AzSpringCloudApp -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway

Get an app deployment

To get an app deployment and its properties in Azure Spring Apps, you use the Get-AzSpringCloudAppDeployment cmdlet. The following example retrieves information about the default Azure Spring Apps deployment.

Get-AzSpringCloudAppDeployment -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway -DeploymentName default

Clean up resources

If the resources created in this article aren't needed, you can delete them by running the examples shown in the following sections.

Delete an app deployment

To remove an app deployment in Azure Spring Apps, you use the Remove-AzSpringCloudAppDeployment cmdlet. The following example deletes an app deployed in Azure Spring Apps named default, for the specified service and app.

Remove-AzSpringCloudAppDeployment -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway -DeploymentName default

Delete an app

To remove an app in Azure Spring Apps, you use the Remove-AzSpringCloudApp cmdlet. The following example deletes the gateway app in the specified service and resource group.

Remove-AzSpringCloudApp -ResourceGroupName <resource group name> -ServiceName <service instance name> -AppName gateway

Delete a service

To remove an Azure Spring Apps service, you use the Remove-AzSpringCloud cmdlet. The following example deletes the specified Azure Spring Apps service.

Remove-AzSpringCloud -ResourceGroupName <resource group name> -ServiceName <service instance name>

Delete the resource group

Caution

The following example deletes the specified resource group and all resources contained within it. If resources outside the scope of this article exist in the specified resource group, they will also be deleted.

Remove-AzResourceGroup -Name <resource group name>

Next steps

Azure Spring Apps developer resources