Author avatar

Michael Levan

Configure Deployment Credentials for Azure App Service

Michael Levan

  • Sep 11, 2020
  • 5 Min read
  • 57 Views
  • Sep 11, 2020
  • 5 Min read
  • 57 Views
IT Infrastructure
Continuous Integration and Deployment Tools
Management and Monitoring
General Continuous Integration and Deployment Principles

Introduction


When you're working in Azure, there are several different ways to deploy applications, whether you're using Azure DevOps, GitHub Actions, or simply configuring deployments at an app service level. With app services, besides the authentication to Azure, you also have separate deployment authentication.

When you configure deployments for app services, it allows you to continuously deploy code to the app service. You don't have to set up a CICD pipeline or transition to any other platform. Instead, whenever you push code to a repository in, say, GitHub for example, the Azure app service will be automatically updated with the new code and deployment will take place in the background automatically.

To deploy to an Azure app service, you need permissions. In this guide, you will learn how to configure deployment credentials for an Azure app service.

Prerequisites

To follow along with this guide, you will need the following:

  • An Azure account
  • Azure CLI. If you don't have Azure CLI installed and configured, you can check out this getting started guide.

Why Deployment Credentials?

When you think about deployments for any code, one of the things that may get overlooked in the beginning is security—security from an outbound perspective, but also inbound. When an app service is created, it can actually be done using anonymous access. That means virtually anyone, in the company or outside of the company, has the possibility of getting access and manipulating it in some way.

With deployment credentials, all of that is not an issue. You have the ability to set up a specific username and password that must be used for authentication in a deployment scenario.

Let's think about a real-world example. Perhaps you're working in a global organization, so there are many teams spread across the world. Because there are teams spread across the world, teams may be working on different pieces of code in each time zone. Instead of having to wake someone up at 2:00 AM to deploy, you have deployment credentials that are shared with contributors to the project. That way, there isn't a single point of failure on any one team or any one person.

Creating an App Service

Before configuring credentials for an app service, the app service needs to exist. In this section, you'll take a look at an easy way to configure an app service using Azure CLI.

  1. Open up a terminal to create the Azure app service plan and the app .
  2. The first Azure CLI command will create the app service plan, which is what hosts the app service.
1
az appservice plan create -g your_resource_group_name -n pluralsightappserviceplan
bash
  1. The second Azure CLI command will create the app service itself.
1
az webapp create -g your_resource_group_name -p pluralsightappserviceplan -n pluralsightapp92
bash

Once you run the Azure CLI commands, you will see a newly created Azure app service in the Azure portal.

Configuring Deployment Credentials

There are two ways of configuring deployment credentials. The first is by using the Azure CLI. This will give you the ability to automate the process so you don't have to worry about manually accessing the UI.

If you'd like to access the UI to configure deployment credentials, or just do it once so you can understand the process from a manual perspective, you can do that as well. That will be the second way shown.

Azure CLI Deployment Credentials

  1. Open up a terminal to set up the deployment credentials using Azure CLI. The following configuration will set the deployment credentials for all apps.
1
az webapp deployment user set --user-name pluralsightapp --password Test123!@#
bash

Of course, you'll want to set a password that is best suited for the environment you're in.

Azure Portal Deployment Credentials

Now that you know how to create credentials automatically, let's see how to do it from the Azure portal.

  1. Open up a web browser and go to the Azure portal .
  2. In the search bar, search for app services .

  1. Choose the app service .

  1. Click on FTP .

  1. Click the blue Dashboard button .

  1. Click on User Credentials and you can enter a username and a password.

Congrats! You have successfully set up deployment credentials for Azure app services.

Conclusion

When you're working with any application, you want to ensure the correct people and departments have the ability to deploy code to it. If there's only one person or one department that has the ability to deploy, chances are the departments are siloed and there is a single point of failure.

In this guide, you learned how to not only create a new app service and app service plan, but ensure that the appropriate users have access to the app service to deploy code.

0