Back to Devexpress

Azure App Service (Linux) in Docker - Create an ASP.NET Core Reporting App Using CLI

xtrareports-404820-cloud-integration-azure-cli-linux-acr-aspnetcore.md

latest6.3 KB
Original Source

Azure App Service (Linux) in Docker - Create an ASP.NET Core Reporting App Using CLI

  • May 27, 2025
  • 5 minutes to read

This topic uses a command-line interface to create a sample ASP.NET Core DevExpress Reporting application that includes Document Viewer and Report Designer, and deploys that application to Azure App Services using a Docker Container from the Azure Container Registry.

Prerequisites

  1. An Azure account with an active subscription.
  2. Your personal DevExpress NuGet credentials. Refer to the following help topic for instructions on how to obtain the feed URL and authorization key, and register the online NuGet feed in your development environment: Choose Between Offline and Online DevExpress NuGet Feeds.
  3. The latest version of Azure Command-Line Interface (CLI). For instructions, review the following topic: Install Azure CLI on Windows.
  4. The latest version of Docker desktop. You can find more information about Docker in the following topic: Get Docker.
  5. Installed DevExpress ASP.NET Core CLI Templates. If not installed, open the console and enter the following command:

Important Disclaimer

The deployment recommendations do not apply to all possible configurations and should not be considered comprehensive. We offer these instructions as a getting-started reference. Steps may vary depending on your operating system, installed software, and DevExpress versions. You, the developer, are responsible for the application, database, network, and other configurations based on your client, security, environment, and other requirements. We recommend that you review these settings with your database, network, and IT infrastructure administrators and consider tailoring their recommendations to your case.

Create a Sample ASP.NET Core DevExpress Reporting Application

Create a sample .NET application with a Report Designer and Document Viewer components. The project uses a Debian-based Docker image and ASP.NET Core distributed caching mechanism to cache reports and related documents.

Run the following command to create a new dxreportingtestapp project from the template:

cli
dotnet new dx.aspnetcore.reporting -n dxreportingtestapp --Dockerfile Debian --DocumentStorage DistributedCache

For information about available options, run:

cli
dotnet new dx.aspnetcore.reporting -h

For more information on the ASP.NET Core Reporting project template: Use DevExpress .NET CLI Templates to Create an ASP.NET Core Reporting App with a Report Designer.

Log in to Azure

Enter the following command:

cli
az login

A new browser window opens and prompts you to complete the authentication process. After successful authentication, your subscription details are displayed in the terminal. Note the id key as it is required when you create the service principal.

cli
[
  {
    "cloudName": "AzureCloud",
    "homeTenantId": "{a homeTenantId identifier}",
    "id": "{your subscription identifier}",
    "isDefault": true,
    "managedByTenants": [],
    "name": "Visual Studio Professional Subscription",
    "state": "Enabled",
    "tenantId": "{a tenantId identifier}",
    "user": {
      "name": "{your user name}",
      "type": "user"
    }
  }
]

Create a Service Principal

An Azure service principal acts as an impersonation for a user in Azure AD.

Run the following command to create a service principal:

cli
az ad sp create-for-rbac --name {specify any name} --scopes /subscriptions/{your subscription identifier} --role owner

You can specify any name for a service principal. The value of {your subscription ID} is the id field from the successful login output.

After creating the service principal account, the terminal displays appId and password. These credentials are necessary to log in to the container registry.

Create a Container Registry

  1. Create a new resource group:

  2. Create a new container registry:

Build a Docker Image

The sample Reporting project dxreportingtestapp created earlier includes a Dockerfile located in the root project folder. Navigate to that folder and run the following command:

cli
docker build -t dxazuretest001.azurecr.io/dxreportingtestapp --secret id=dxnuget,source=secrets.dev.yaml .

The dxazuretest001.azurecr.io is the loginServer field value from the container registry creation output in the previous step.

You can test the application and run the Docker image locally using the following command:

cli
docker run -p 8080:80 dxreportingtestapp:latest

The application will run on port 8080.

Push an Image to the Registry

  1. Log in to the Azure Container registry using the following command:

  2. Push the image to a registry using the following command:

  3. Remove the dxreportingtestapp:latest image from your local Docker environment:

Create a Container

The following command creates a container in a container group DXAzureGr with 1 core, 1Gb of memory, a public IP address, port 80, and the DNS name label dxreporting001:

cli
az container create --resource-group DXAzureGr --name dxazuretest001 --image dxazuretest001.azurecr.io/dxreportingtestapp:latest --cpu 1 --memory 1 --registry-login-server dxazuretest001.azurecr.io --registry-username {appId created for service principal} --registry-password {password created for service principal} --ip-address Public --dns-name-label dxreporting001 --ports 80

The appId and password credentials are obtained in the Create a Service Principal step. The dns name label must be unique for a container group with public IP.

When the container is created successfully, the output includes the application FQDN: dxreporting001.westus.azurecontainer.io.

Test the Application

Open the published application in your browser:

dxreporting001.westus.azurecontainer.io