Skip to content

Commit 9a9afaa

Browse files
Merge pull request #264166 from Sneezry/patch-12
Update how-to-enterprise-service-registry.md
2 parents cc05e0a + d6b26d9 commit 9a9afaa

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

articles/spring-apps/enterprise/how-to-enterprise-service-registry.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ with the Azure Spring Apps Enterprise plan, you don't have to create or start th
3131

3232
## Create applications that use Service Registry
3333

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:
3535

3636
:::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.":::
3737

@@ -183,15 +183,15 @@ The `--assign-endpoint` argument grants a public IP for validation and enables a
183183

184184
### Connect to the Service Registry from the app
185185

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.
187187

188188
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:
189189

190190
```properties
191191
eureka.client.service-url.defaultZone=http://eureka:8761/eureka/
192192
```
193193

194-
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.
195195

196196
In practice, the following environment variables are added to the `JAVA_TOOL_OPTIONS` variable:
197197

@@ -210,18 +210,32 @@ az spring service-registry bind \
210210
--app serviceA
211211
```
212212

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:
214214

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.":::
216216

217217
> [!NOTE]
218218
> These changes will take a few minutes to propagate to all applications when the service registry status changes.
219219
>
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.":::
221235

222236
### Deploy an application to Azure Spring Apps
223237

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:
225239

226240
```azurecli
227241
az spring app deploy \
@@ -275,7 +289,7 @@ This command produces the following output.
275289
"JAVA_TOOL_OPTIONS":"-Deureka.client.service-url.defaultZone=https://$AZURE_SPRING_APPS_NAME.svc.azuremicroservices.io/eureka/default/eureka
276290
```
277291

278-
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.
279293

280294
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.
281295

@@ -408,7 +422,7 @@ az spring app list \
408422
--output table
409423
```
410424

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.
412426

413427
```output
414428
Name Location ResourceGroup Public Url Production Deployment Provisioning State CPU Memory Running Instance Registered Instance Persistent Storage Bind Service Registry Bind Application Configuration Service
Loading

0 commit comments

Comments
 (0)