Редактиране

Споделяне чрез


Connect applications in Azure Container Apps

Azure Container Apps exposes each container app through a domain name if ingress is enabled. You can expose ingress endpoints either publicly to the world or to the other container apps in the same environment. Alternatively, you can limit ingress to only other container apps in the same environment.

Application code can call other container apps in the same environment using one of the following methods:

  • default fully qualified domain name (FQDN)
  • a custom domain name
  • the container app name, for instance http://<APP_NAME> for internal requests
  • a Dapr URL

Note

When you call another container in the same environment using the FQDN or app name, the network traffic never leaves the environment.

A sample solution showing how you can call between containers using both the FQDN Location or Dapr can be found on Azure Samples

Location

A container app's location is composed of values associated with its environment, name, and region. Available through the azurecontainerapps.io top-level domain, the fully qualified domain name (FQDN) uses:

  • the container app name
  • the environment unique identifier
  • region name

The following diagram shows how these values are used to compose a container app's fully qualified domain name.

Azure Container Apps container app fully qualified domain name.

Get fully qualified domain name

The az containerapp show command returns the fully qualified domain name of a container app.

az containerapp show \
  --resource-group <RESOURCE_GROUP_NAME> \
  --name <CONTAINER_APP_NAME> \
  --query properties.configuration.ingress.fqdn

In this example, replace the placeholders surrounded by <> with your values.

The value returned from this command resembles a domain name like the following example:

myapp.happyhill-70162bb9.canadacentral.azurecontainerapps.io

Dapr location

Developing microservices often requires you to implement patterns common to distributed architecture. Dapr allows you to secure microservices with mutual Transport Layer Security (TLS) (client certificates), trigger retries when errors occur, and take advantage of distributed tracing when Azure Application Insights is enabled.

A microservice that uses Dapr is available through the following URL pattern:

Azure Container Apps container app location with Dapr.

Call a container app by name

You can call a container app by doing by sending a request to http://<CONTAINER_APP_NAME> from another app in the environment.

Next steps