Azure App Spaces (preview) Overview
Tags: azure, azureappspaces
Published: 2024-01-30 12:52:07

Hi everyone, in today's post we're going to talk about Azure App Spaces, a new service from Azure (Microsoft) that promises to facilitate the creation and deployment of applications.

This new service has two main functions, one of them helps to define the best service(s) to be used by the application through an analysis that Azure itself carries out in the repository.

The other feature is to select an out-of-the-box template that you may to use and Azure will take care of deploying the entire application and necessary infrastructure. There are currently 4 main templates you can choose from, as seen below.

- **React Container App with C# API and PostgreSQL**

- **React Web App with Python API and MongoDB**

- **Static React Web App with Node.js API and MongoDB**

- **React Web App with C#/.NET and SQL Database**

> Note: All information has been extracted from the Azure Portal, so it can be changed at any time as the service is still in preview.

You can see the default page of Azure App Spaces bellow

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/in70jxcdd0h0nquakoxk.png)

### Microsoft Definition

To better understand what this new service is all about, here is an official explanation from Microsoft's documentation.

> Azure App Spaces is an intelligent service for developers that reduces the complexity of creating and managing web apps. It helps you identify the correct services for your applications on Azure and provides a user-friendly management experience that's streamlined for the development process.

> App Spaces offers all the benefits of deploying an app via existing Azure services, like Container Apps, Static Web Apps, and App Service, with an experience that's focused on making you develop and deploy faster.

_**Azure App Spaces is still in preview, so be aware that potential bugs may be encountered.**_

_Note: The only supported service is GitHub for now, but as the service is in preview, new ways of integrations may be added in the future._

## Using an existing repository – How does it work?

I have prepared two different scenarios to better explain how the service works.

#### Scenario 1

In the first scenario, we're going to use a simple HTML page. Basically I just created a simple HTML file on GitHub and pushed the code in the main branch, you can do the same thing.

On the Azure App Spaces default page, select the **_Start deploying_** option as shown below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cph54ee7kk4ej2k7lt9j.png)

Select the Organization, Repository and Branch you'd like to deploy.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3lv7q0g1a04zy3jsfnov.png)

After that, the service will analyze the entire repository and advice you about the best service. In my case, Azure suggested using Azure Static Web App demonstrating good accuracy, as it was in fact the most suitable service.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4k48nhylegj48nwf0l7e.png)

Scrolling down, we need to define some information about the application and also the details of creating the Azure Static Web App.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r530lt8fpgps28g4mari.png)

Once deployment begins, magic happens. On deployment, Azure creates and adds a CI/CD (GitHub Actions) pipeline to the repository you selected to use. Although the pipeline is very simple, it's enough to deploy the application.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5zo9zq80i0ms6jdy103.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n9ejz5gmrz3gaiihqa2v.png)

The resources were automatically created in Azure, so you don't have to worry about that either.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3x4pj2svlbz24fvypvfr.png)

#### Scenario 2

In the second example, we will use a .NET project that I implemented. Again, go to the App Spaces home page, select the _Start deploying_ option and select the new repository with the .NET project. The suggestion was to use Azure App Service and again the choice was very assertive.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mn2gbstxwbaqeqf5icu8.png)

Once the deploy button is clicked again, a new CI/CD pipeline will be added to the repository and the required resources will be created automatically.

## Using Templates - How does it work?

Now, let's demonstrate how to use templates. Basically if you want to start a new app, you can use a out-of-the-box template and just adapt according to your needs.

As I said, we currently have 4 templates available to be used and for this scenario, we'll select the _React Web App template with C#/.NET and SQL Database_.

Select the template, define some information and click the deploy button.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k02pbgq0bp5l7jfkz44l.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46tjrhcsxq57dstcy0ny.png)

Azure will start creating your application and the resources run it. The entire process take a while to be completed.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mq2tsg3it1ft1nughevy.png)

In summary, once the process is completed, we have a new GitHub repository with the application (front-end and back-end) and a CI/CD pipeline to deploy the code.

Also in the repository we have a directory called infra, inside we find a bicep file (IaC) which is basically the application infrastructure at code level where all the configuration necessary to run the application is ready, without the need for any adjustments.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uw70kfsnizw7q4q5svs.png)

The CI/CD pipeline is responsible for deploying the infrastructure by executing the biceps file and also the application itself.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s5vdjnqsll6ayvnss0hx.png)

You will have an entire application up and running without the need to set a connection between back-end and database or between front-end and back-end.

Powerful, isn't it?

### Brief Summary
Let's highlight the main points:

- The resource only supports GitHub
- There are same templates with out-of-the-box application.
- A CI/CD pipeline is used to deploy the infrastructure together bicep file when using a template.
- CI/CD pipeline is also used to deploy the application 
- All application settings and keys (secrets) are included in the pipeline or in bicep, you don't need to adjust anything.

**Note:** _I haven't tested other scenarios but the process is basically the same as we demonstrated above. I also don't know if the accuracy of the analysis will be good in complex scenarios, but I'll bring new tests in the future._

Highlighting an important point, when using templates, a new repository is created containing all the files needed to deploy both the application and the infrastructure, it's possible to redeploy if necessary, while using an existing repository, Azure will just create the pipeline of CI/CD to deploy the application, you don't have the biceps file to create the infrastructure.

###Conclusion
Although the feature is in preview, it's an excellent option to help and improve software delivery in companies. With its analysis capacity, it will certainly be a very useful tool to help you decide which is the best resource to use in a given scenario.

The templates will speed up the creation and delivery of the software to customers, since all aspects have already been adjusted, so the focus will be entirely on the functionalities that will need to be developed.

One more thing to mention, when using templates, in addition to just creating the application and infrastructure, Azure provides good security practices, such as creating an instance of the Azure Key Vault already set with the application, the connection between the back-end and the database is done via managed identity, among many other things that I could see by analyzing the repository. It's really not just the experience of creating a solution and executing it, it's the experience of having a ready-to-use solution, with a good level of security associated, with the best possible practices.

Reference
https://learn.microsoft.com/en-us/azure/app-spaces/overview