You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 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)
# Stream Azure Spring Apps application console logs in realtime
13
13
14
14
> [!NOTE]
15
15
> 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.
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).
22
22
23
23
## Prerequisites
24
24
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).
27
27
28
-
## Use CLI to tail logs
28
+
## Use Azure CLI to produce tail logs
29
29
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:
31
31
32
32
```azurecli
33
-
az config set defaults.group=<servicegroupname>
34
-
az config set defaults.spring-cloud=<serviceinstancename>
33
+
az config set defaults.group=<service-group-name>
34
+
az config set defaults.spring-cloud=<service-instance-name>
35
35
```
36
36
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.
38
38
39
-
### Tail log for app with single instance
39
+
### View the tail log for an app with a single instance
40
40
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:
42
42
43
43
```azurecli
44
-
az spring app logs --name <applicationname>
44
+
az spring app logs --name <application-name>
45
45
```
46
46
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.
48
48
49
49
```output
50
50
...
@@ -56,11 +56,11 @@ This will return logs similar to the following examples, where `auth-service` is
56
56
...
57
57
```
58
58
59
-
### Tail log for app with multiple instances
59
+
### View the tail log for an app with multiple instances
60
60
61
61
If multiple instances exist for the app named `auth-service`, you can view the instance log by using the `-i/--instance` option.
62
62
63
-
First, you can get the app instance names with following command.
63
+
First, run the following command to get the app instance names:
64
64
65
65
```azurecli
66
66
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
76
76
auth-service-default-12-75cc4577fc-n25mh Running UP
77
77
```
78
78
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:
80
80
81
81
```azurecli
82
82
az spring app logs --name auth-service --instance auth-service-default-12-75cc4577fc-pw7hb
83
83
```
84
84
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**.
86
86
87
87
### Continuously stream new logs
88
88
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:
90
90
91
91
```azurecli
92
92
az spring app logs --name auth-service --follow
93
93
```
94
94
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`.
96
96
97
-
To check all the logging options supported:
97
+
Use the following command to check all the logging options that are supported:
98
98
99
99
```azurecli
100
100
az spring app logs --help
@@ -103,9 +103,11 @@ az spring app logs --help
103
103
### Format JSON structured logs
104
104
105
105
> [!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.
107
107
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:
109
111
110
112
```azurecli
111
113
# Raw JSON log
@@ -119,7 +121,9 @@ $ az spring app logs --name auth-service --format-json
119
121
2021-05-26T03:35:27.533Z INFO [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
120
122
```
121
123
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:
## 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
+
137
183
## Next steps
138
184
139
185
*[Quickstart: Monitoring Azure Spring Apps apps with logs, metrics, and tracing](./quickstart-logs-metrics-tracing.md)
0 commit comments