Skip to content

Commit 326a10d

Browse files
Merge pull request #203737 from Descatles/wenhao/vnet_endpoint
Add Docs for app and log stream public endpoint in vnet injection instance
2 parents d5ed424 + 793d24e commit 326a10d

File tree

5 files changed

+148
-26
lines changed

5 files changed

+148
-26
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Expose applications on Azure Spring Apps to the internet from a public network
3+
description: Describes how to expose applications on Azure Spring Apps to the internet from a public network.
4+
author: karlerickson
5+
ms.author: karler
6+
ms.service: spring-cloud
7+
ms.topic: how-to
8+
ms.date: 08/09/2022
9+
ms.custom: devx-track-java, devx-track-azurecli, event-tier1-build-2022
10+
ms.devlang: azurecli
11+
---
12+
13+
# Expose applications on Azure Spring Apps to the internet from a public network
14+
15+
> [!NOTE]
16+
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
17+
18+
This article describes how to expose applications on Azure Spring Apps to the internet from a public network.
19+
20+
You can expose applications to the internet with TLS Termination or end-to-end TLS using Application Gateway. These approaches are described in [Expose applications to the internet with TLS Termination at Application Gateway](./expose-apps-gateway-tls-termination.md) and [Expose applications with end-to-end TLS in a virtual network](./expose-apps-gateway-end-to-end-tls.md). These approaches work well, but Application Gateway can involve a complicated setup and extra expense.
21+
22+
If you don't want to use Application Gateway for advanced operations, you can expose your applications to the internet with one click using the Azure portal or one command using the Azure CLI. The only extra expense is a standard public IP for one Azure Spring Apps service instance, regardless of how many apps you want to expose.
23+
24+
## Prerequisites
25+
26+
- An Azure Spring Apps service instance deployed in a virtual network and an app created in it. For more information, see [Deploy Azure Spring Apps in a virtual network](./how-to-deploy-in-azure-virtual-network.md).
27+
28+
## Assign a public fully qualified domain name (FQDN) for your application in a VNet injection instance
29+
30+
31+
### [Azure portal](#tab/azure-portal)
32+
33+
Use the following steps to assign a public FQDN for your application.
34+
35+
1. Select the Azure Spring Apps service instance deployed in your virtual network, and then open the **Apps** tab in the menu on the left.
36+
37+
1. Select the application to show the **Overview** page.
38+
39+
1. Select **Assign Public Endpoint** to assign a public FQDN to your application. Assigning an FQDN can take a few minutes.
40+
41+
:::image type="content" source="media/how-to-access-app-from-internet-virtual-network/assign-public-endpoint.png" alt-text="Screenshot of Azure portal showing how to assign a public FQDN to your application." lightbox="media/how-to-access-app-from-internet-virtual-network/assign-public-endpoint.png":::
42+
43+
The assigned public FQDN (labeled **URL**) is now available. It can only be accessed within the public network.
44+
45+
### [Azure CLI](#tab/azure-CLI)
46+
47+
Use the following command to assign a public endpoint to your app. Be sure to replace the placeholders with your actual values.
48+
49+
```azurecli
50+
az spring app update \
51+
--resource-group <resource-group-name> \
52+
--name <app-name> \
53+
--service <service-instance-name> \
54+
--assign-public-endpoint true
55+
```
56+
57+
---
58+
59+
## Use a public URL to access your application from both inside and outside the virtual network
60+
61+
You can use a public URL to access your application both inside and outside the virtual network. Follow the steps in [Access your application in a private network](./access-app-virtual-network.md) to bind the domain `.private.azuremicroservices.io` to the service runtime Subnet private IP address in your private DNS zone while keeping the **Assign Endpoint** in a disable state. You can then access the app using the **public URL** from both inside and outside the virtual network.
62+
63+
## Secure traffic to the public endpoint
64+
65+
To ensure the security of your applications when you expose a public endpoint for them, secure the endpoint by filtering network traffic to your service with a network security group. For more information, see [Tutorial: Filter network traffic with a network security group using the Azure portal](../virtual-network/tutorial-filter-network-traffic.md). A network security group contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources. For each rule, you can specify source and destination, port, and protocol.
66+
67+
> [!NOTE]
68+
> If you couldn't access your application in VNet injection instance from internet after you have assigned a public FQDN, check your network security group first to see whether you have allowed such inbound traffic.
69+
70+
## Next steps
71+
72+
- [Expose applications with end-to-end TLS in a virtual network](./expose-apps-gateway-end-to-end-tls.md)
73+
- [Troubleshooting Azure Spring Apps in virtual networks](./troubleshooting-vnet.md)
74+
- [Customer responsibilities for running Azure Spring Apps in VNET](./vnet-customer-responsibilities.md)

articles/spring-apps/how-to-log-streaming.md

Lines changed: 72 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Stream Azure Spring Apps app logs in real-time
3-
description: How to use log streaming to view application logs instantly
2+
title: Stream Azure Spring Apps application console logs in real time
3+
description: Describes how to use log streaming to view application logs in real time
44
author: karlerickson
55
ms.author: karler
66
ms.service: spring-apps
77
ms.topic: how-to
8-
ms.date: 01/14/2019
8+
ms.date: 08/10/2022
99
ms.custom: devx-track-java, devx-track-azurecli, event-tier1-build-2022
1010
---
1111

12-
# Stream Azure Spring Apps app logs in real-time
12+
# Stream Azure Spring Apps application console logs in real time
1313

1414
> [!NOTE]
1515
> Azure Spring Apps is the new name for the Azure Spring Cloud service. Although the service has a new name, you'll see the old name in some places for a while as we work to update assets such as screenshots, videos, and diagrams.
@@ -18,33 +18,33 @@ ms.custom: devx-track-java, devx-track-azurecli, event-tier1-build-2022
1818

1919
**This article applies to:** ✔️ Basic/Standard tier ✔️ Enterprise tier
2020

21-
Azure Spring Apps enables log streaming in Azure CLI to get real-time application console logs for troubleshooting. You can also [Analyze logs and metrics with diagnostics settings](./diagnostic-services.md).
21+
This article describes how to enable log streaming in Azure CLI to get real-time application console logs for troubleshooting. You can also use diagnostics settings to analyze diagnostics data in Azure Spring Apps. For more information, see [Analyze logs and metrics with diagnostics settings](./diagnostic-services.md).
2222

2323
## Prerequisites
2424

25-
* [Azure CLI](/cli/azure/install-azure-cli) with the Azure Spring Apps extension, minimum version 1.0.0. You can install the extension by using the following command: `az extension add --name spring`
26-
* An instance of **Azure Spring Apps** with a running application. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
25+
- [Azure CLI](/cli/azure/install-azure-cli) with the Azure Spring Apps extension, minimum version 1.0.0. You can install the extension by using the following command: `az extension add --name spring`
26+
- An instance of Azure Spring Apps with a running application. For more information, see [Quickstart: Deploy your first application to Azure Spring Apps](./quickstart.md).
2727

28-
## Use CLI to tail logs
28+
## Use Azure CLI to produce tail logs
2929

30-
To avoid repeatedly specifying your resource group and service instance name, set your default resource group name and cluster name.
30+
This section provides examples of using Azure CLI to produce tail logs. To avoid repeatedly specifying your resource group and service instance name, use the following commands to set your default resource group name and cluster name:
3131

3232
```azurecli
33-
az config set defaults.group=<service group name>
34-
az config set defaults.spring-cloud=<service instance name>
33+
az config set defaults.group=<service-group-name>
34+
az config set defaults.spring-cloud=<service-instance-name>
3535
```
3636

37-
In following examples, the resource group and service name will be omitted in the commands.
37+
The resource group and service name are omitted in the following examples.
3838

39-
### Tail log for app with single instance
39+
### View the tail log for an app with a single instance
4040

41-
If an app named auth-service has only one instance, you can view the log of the app instance with the following command:
41+
If an app named `auth-service` has only one instance, you can view the log of the app instance with the following command:
4242

4343
```azurecli
44-
az spring app logs --name <application name>
44+
az spring app logs --name <application-name>
4545
```
4646

47-
This will return logs similar to the following examples, where `auth-service` is the application name.
47+
This command returns logs similar to the following examples, where `auth-service` is the application name.
4848

4949
```output
5050
...
@@ -56,11 +56,11 @@ This will return logs similar to the following examples, where `auth-service` is
5656
...
5757
```
5858

59-
### Tail log for app with multiple instances
59+
### View the tail log for an app with multiple instances
6060

6161
If multiple instances exist for the app named `auth-service`, you can view the instance log by using the `-i/--instance` option.
6262

63-
First, you can get the app instance names with following command.
63+
First, run the following command to get the app instance names:
6464

6565
```azurecli
6666
az spring app show --name auth-service --query properties.activeDeployment.properties.instances --output table
@@ -76,25 +76,25 @@ auth-service-default-12-75cc4577fc-8nt4m Running UP
7676
auth-service-default-12-75cc4577fc-n25mh Running UP
7777
```
7878

79-
Then, you can stream logs of an app instance with the option `-i/--instance` option:
79+
Then, you can stream logs of an app instance using the `-i/--instance` option, as follows:
8080

8181
```azurecli
8282
az spring app logs --name auth-service --instance auth-service-default-12-75cc4577fc-pw7hb
8383
```
8484

85-
You can also get details of app instances from the Azure portal. After selecting **Apps** in the left navigation pane of your Azure Spring Apps service, select **App Instances**.
85+
You can also get details of app instances from the Azure portal. After selecting **Apps** in the left navigation pane of your Azure Spring Apps service, select **App Instances**.
8686

8787
### Continuously stream new logs
8888

89-
By default, `az spring app logs` prints only existing logs streamed to the app console and then exits. If you want to stream new logs, add `-f/--follow`:
89+
By default, `az spring app logs` prints only existing logs streamed to the app console, and then exits. If you want to stream new logs, add the `-f/--follow` argument:
9090

9191
```azurecli
9292
az spring app logs --name auth-service --follow
9393
```
9494

95-
When you use `--follow` to tail instant logs, the Azure Spring Apps log streaming service will send heartbeat logs to the client every minute unless your application is writing logs constantly. These heartbeat log messages look like `2020-01-15 04:27:13.473: No log from server`.
95+
When you use the `--follow` argument to tail instant logs, the Azure Spring Apps log streaming service sends heartbeat logs to the client every minute unless your application is writing logs constantly. Heartbeat log messages use the following format: `2020-01-15 04:27:13.473: No log from server`.
9696

97-
To check all the logging options supported:
97+
Use the following command to check all the logging options that are supported:
9898

9999
```azurecli
100100
az spring app logs --help
@@ -103,9 +103,11 @@ az spring app logs --help
103103
### Format JSON structured logs
104104

105105
> [!NOTE]
106-
> Requires spring extension version 2.4.0 or later.
106+
> Formatting JSON structured logs requires spring extension version 2.4.0 or later.
107107
108-
When the [Structured application log](./structured-app-log.md) is enabled for the app, the logs are printed in JSON format. This makes it difficult to read. The `--format-json` argument can be used to format the JSON logs into human readable format.
108+
Structured application logs are displayed in JSON format, which can be difficult to read. You can use the `--format-json` argument to format logs in JSON format into a more readable format. For more information, see [Structured application log for Azure Spring Apps](./structured-app-log.md).
109+
110+
The following example shows how to use the `--format-json` argument:
109111

110112
```azurecli
111113
# Raw JSON log
@@ -119,7 +121,9 @@ $ az spring app logs --name auth-service --format-json
119121
2021-05-26T03:35:27.533Z INFO [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
120122
```
121123

122-
The `--format-json` argument also takes optional customized format, using the keyword argument [format string syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
124+
The `--format-json` argument also accepts an optional customized format using format string syntax. For more information, see [Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax).
125+
126+
The following example shows how to use format string syntax:
123127

124128
```azurecli
125129
# Custom format
@@ -134,6 +138,48 @@ Single vip registry refresh property : null
134138
> {timestamp} {level:>5} [{thread:>15.15}] {logger{39}:<40.40}: {message}{n}{stackTrace}
135139
> ```
136140
141+
## Stream an Azure Spring Apps app log in a VNet injection instance
142+
143+
For an Azure Spring Apps instance deployed in a custom virtual network, you can access log streaming by default from a private network. For more information, see [Deploy Azure Spring Apps in a virtual network](./how-to-deploy-in-azure-virtual-network.md)
144+
145+
Azure Spring Apps also enables you to access real-time app logs from a public network using Azure portal or the Azure CLI.
146+
147+
### [Azure portal](#tab/azure-portal)
148+
149+
Use the following steps to enable a log streaming endpoint on the public network.
150+
151+
1. Select the Azure Spring Apps service instance deployed in your virtual network, and then open the **Networking** tab in the navigation menu.
152+
153+
1. Select the **Vnet injection** page.
154+
155+
1. Switch the status of **Log streaming on public network** to **enable** to enable a log streaming endpoint on the public network. This process will take a few minutes.
156+
157+
:::image type="content" source="media/how-to-log-streaming/enable-logstream-public-endpoint.png" alt-text="Screenshot of enabling a log stream public endpoint on the Vnet Injection page." lightbox="media/how-to-log-streaming/enable-logstream-public-endpoint.png":::
158+
159+
#### [CLI](#tab/azure-CLI)
160+
161+
Use the following command to enable the log stream public endpoint.
162+
163+
```azurecli
164+
az spring update \
165+
--resource-group <resource-group-name> \
166+
--service <service-instance-name> \
167+
--enable-log-stream-public-endpoint true
168+
```
169+
170+
After you've enabled the log stream public endpoint, you can access the app log from a public network as you would access a normal instance.
171+
172+
---
173+
174+
## Secure traffic to the log streaming public endpoint
175+
176+
Log streaming uses the same key as the test endpoint described in [Set up a staging environment in Azure Spring Apps](./how-to-staging-environment.md) to authenticate the connections to your deployments. As a result, only users who have read access to the test keys can access log streaming.
177+
178+
To ensure the security of your applications when you expose a public endpoint for them, secure the endpoint by filtering network traffic to your service with a network security group. For more information, see [Tutorial: Filter network traffic with a network security group using the Azure portal](../virtual-network/tutorial-filter-network-traffic.md). A network security group contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources. For each rule, you can specify source and destination, port, and protocol.
179+
180+
> [!NOTE]
181+
> If you can't access app logs in the VNet injection instance from the internet after you've enabled a log stream public endpoint, check your network security group to see whether you've allowed such inbound traffic.
182+
137183
## Next steps
138184

139185
* [Quickstart: Monitoring Azure Spring Apps apps with logs, metrics, and tracing](./quickstart-logs-metrics-tracing.md)
22.2 KB
Loading
46.9 KB
Loading

articles/spring-apps/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ items:
210210
href: expose-apps-gateway-tls-termination.md
211211
- name: Expose applications to the internet with end-to-end TLS/SSL
212212
href: expose-apps-gateway-end-to-end-tls.md
213+
- name: Expose applications to the internet from a public network
214+
href: how-to-access-app-from-internet-virtual-network.md
213215
- name: Configure Palo Alto
214216
href: how-to-configure-palo-alto.md
215217
- name: Customer responsibilities running Azure Spring Apps in VNET

0 commit comments

Comments
 (0)