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
Copy file name to clipboardExpand all lines: articles/spring-apps/enterprise/how-to-enterprise-service-registry.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ with the Azure Spring Apps Enterprise plan, you don't have to create or start th
31
31
32
32
## Create applications that use Service Registry
33
33
34
-
In this article, you'll create two services and register them with Azure Spring Apps Service Registry. After registration, one service will be able to use Service Registry to discover and invoke the other service. The following diagram summarizes the required steps:
34
+
In this article, you create two services and register them with Azure Spring Apps Service Registry. After registration, one service will be able to use Service Registry to discover and invoke the other service. The following diagram summarizes the required steps:
35
35
36
36
:::image type="content" source="./media/how-to-enterprise-service-registry/how-to-guide-story.png" alt-text="Diagram showing the steps to create, deploy, and register Service A and Service B.":::
37
37
@@ -183,15 +183,15 @@ The `--assign-endpoint` argument grants a public IP for validation and enables a
183
183
184
184
### Connect to the Service Registry from the app
185
185
186
-
You've now created a service with Spring Boot and created an application in Azure Spring Apps. The next task is to deploy the application and confirm the operation. Before that, however, you must bind your application to the Service Registry so that it can get connection information from the registry.
186
+
After you create a service instance with Spring Boot and create an application in Azure Spring Apps, you deploy the application and confirm the operation. Before that, however, you must bind your application to the Service Registry so that it can get connection information from the registry.
187
187
188
188
Typically, a Eureka client needs to write the following connection information settings in the *application.properties* configuration file of a Spring Boot application so that you can connect to the server:
However, if you write these settings directly in your application, you'll need to re-edit and rebuild the project again each time the Service Registry server changes. To avoid this effort, Azure Spring Apps enables your applications to get connection information from the service registry by binding to it. Specifically, after binding the application to the Service Registry, you can get the service registry connection information (`eureka.client.service-url.defaultZone`) from the Java environment variable. In this way, you can connect to the Service Registry by loading the contents of the environment variables when the application starts.
194
+
However, if you write these settings directly in your application, you need to re-edit and rebuild the project again each time the Service Registry server changes. To avoid this effort, Azure Spring Apps enables your applications to get connection information from the service registry by binding to it. Specifically, after binding the application to the Service Registry, you can get the service registry connection information (`eureka.client.service-url.defaultZone`) from the Java environment variable. In this way, you can connect to the Service Registry by loading the contents of the environment variables when the application starts.
195
195
196
196
In practice, the following environment variables are added to the `JAVA_TOOL_OPTIONS` variable:
197
197
@@ -210,18 +210,32 @@ az spring service-registry bind \
210
210
--app serviceA
211
211
```
212
212
213
-
You can also set up the application bindings from the Azure portal, as shown in the following screenshot.
213
+
You can also set up the application bindings from the Azure portal, as shown in the following screenshot:
214
214
215
-
:::image type="content" source="./media/how-to-enterprise-service-registry/spring-cloud-service-registry-bind-app.png" alt-text="Azure portal screenshot of 'Service Registry' screen with 'App binding' section showing.":::
215
+
:::image type="content" source="./media/how-to-enterprise-service-registry/spring-cloud-service-registry-bind-app.png" alt-text="Screenshot of the Azure portal that shows the Service Registry page with the App binding dropdown highlighted.":::
216
216
217
217
> [!NOTE]
218
218
> These changes will take a few minutes to propagate to all applications when the service registry status changes.
219
219
>
220
-
> If you change the binding/unbinding status, you'll need to restart or redeploy the application.
220
+
> If you change the binding/unbinding status, you need to restart or redeploy the application.
221
+
222
+
You can now choose to bind your application to the Service Registry directly when creating a new app by using the following commands:
223
+
224
+
```azurecli
225
+
az spring app create \
226
+
--resource-group <resource-group> \
227
+
--service <service-name> \
228
+
--name <app-name> \
229
+
--bind-service-registry
230
+
```
231
+
232
+
You can also bind your application to the Service Registry from the Azure portal, as shown in the following screenshot:
233
+
234
+
:::image type="content" source="./media/how-to-enterprise-service-registry/spring-cloud-service-registry-bind-app-when-creation.png" alt-text="Screenshot of the Azure portal that shows the Create App page with the Bind dropdown highlighted.":::
221
235
222
236
### Deploy an application to Azure Spring Apps
223
237
224
-
Now that you've bound your application, you'll deploy the Spring Boot artifact file *Sample-Service-A-A-0.0.1-SNAPSHOT.jar* to Azure Spring Apps. To deploy, use the following command:
238
+
Now that you bound your application, deploy the Spring Boot artifact file *Sample-Service-A-A-0.0.1-SNAPSHOT.jar* to Azure Spring Apps. To deploy, use the following command:
225
239
226
240
```azurecli
227
241
az spring app deploy \
@@ -275,7 +289,7 @@ This command produces the following output.
As you can see, `eureka.client.service-url.defaultZone`has been added to `JAVA_TOOL_OPTIONS`. In this way, the application can register the service to the Service Registry and make it available from other services.
292
+
As you can see, `eureka.client.service-url.defaultZone`is added to `JAVA_TOOL_OPTIONS`. In this way, the application can register the service to the Service Registry and make it available from other services.
279
293
280
294
You can now register the service to the Service Registry (Eureka Server) in Azure Spring Apps. Other services can now access the service by using service registry.
281
295
@@ -408,7 +422,7 @@ az spring app list \
408
422
--output table
409
423
```
410
424
411
-
If Service A and Service B are deployed correctly, this command will produce output similar to the following example.
425
+
If Service A and Service B are deployed correctly, this command produces output similar to the following example.
412
426
413
427
```output
414
428
Name Location ResourceGroup Public Url Production Deployment Provisioning State CPU Memory Running Instance Registered Instance Persistent Storage Bind Service Registry Bind Application Configuration Service
0 commit comments