xtrareports-404820-cloud-integration-azure-cli-linux-acr-aspnetcore.md
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.
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 .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:
dotnet new dx.aspnetcore.reporting -n dxreportingtestapp --Dockerfile Debian --DocumentStorage DistributedCache
For information about available options, run:
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.
Enter the following command:
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.
[
{
"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"
}
}
]
An Azure service principal acts as an impersonation for a user in Azure AD.
Run the following command to create a service principal:
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 new resource group:
Create a new container registry:
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:
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:
docker run -p 8080:80 dxreportingtestapp:latest
The application will run on port 8080.
Log in to the Azure Container registry using the following command:
Push the image to a registry using the following command:
Remove the dxreportingtestapp:latest image from your local Docker environment:
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:
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.
Open the published application in your browser:
dxreporting001.westus.azurecontainer.io