Skip to content

Commit 090e28b

Browse files
committed
edit pass: integrate-azure-cache-for-redis-with-service-connector
1 parent 20cf704 commit 090e28b

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

articles/service-connector/how-to-integrate-redis-cache.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Use the following environment variable names and application properties to conne
5151
#### Sample code
5252

5353
The following steps and code show you how to use a system-assigned managed identity to connect to Redis.
54+
5455
[!INCLUDE [code sample for redis](./includes/code-redis-me-id.md)]
5556

5657
### User-assigned managed identity
@@ -63,6 +64,7 @@ The following steps and code show you how to use a system-assigned managed ident
6364
#### Sample code
6465

6566
The following steps and code show you how to use a user-assigned managed identity to connect to Redis.
67+
6668
[!INCLUDE [code sample for Redis](./includes/code-redis-me-id.md)]
6769

6870
### Connection string
@@ -125,6 +127,7 @@ The following steps and code show you how to use a user-assigned managed identit
125127
#### Sample code
126128

127129
The following steps and code show you how to use a connection string to connect to Azure Cache for Redis.
130+
128131
[!INCLUDE [code for redis](./includes/code-redis-secret.md)]
129132

130133
### Service principal
@@ -139,6 +142,7 @@ The following steps and code show you how to use a connection string to connect
139142
#### Sample code
140143

141144
The following steps and code show you how to use a service principal to connect to Redis.
145+
142146
[!INCLUDE [code sample for Redis](./includes/code-redis-me-id.md)]
143147

144148
## Related content

articles/service-connector/includes/code-redis-me-id.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ ms.author: xiaofanzhou
1010
#### [.NET](#tab/dotnet)
1111

1212
1. Install dependencies.
13+
1314
```bash
1415
dotnet add package Microsoft.Azure.StackExchangeRedis --version 3.2.0
1516
```
17+
1618
1. Add the authentication logic with environment variables set by Service Connector. For more information, see [Microsoft.Azure.StackExchangeRedis Extension](https://github.com/Azure/Microsoft.Azure.StackExchangeRedis).
17-
18-
19+
1920
```csharp
2021
using StackExchange.Redis;
2122
var cacheHostName = Environment.GetEnvironmentVariable("AZURE_REDIS_HOST");
@@ -38,10 +39,11 @@ ms.author: xiaofanzhou
3839
3940
var connectionMultiplexer = await ConnectionMultiplexer.ConnectAsync(configurationOptions);
4041
```
41-
42+
4243
#### [Java](#tab/java)
4344
4445
1. Add the following dependency in your `pom.xml` file:
46+
4547
```xml
4648
<dependency>
4749
<groupId>com.azure</groupId>
@@ -55,7 +57,9 @@ ms.author: xiaofanzhou
5557
<version>5.1.0</version> <!-- {x-version-update;redis.clients:jedis;external_dependency} -->
5658
</dependency>
5759
```
60+
5861
1. Add the authentication logic with environment variables set by Service Connector. For more information, see [Azure-AAD-Authentication-With-Jedis](https://aka.ms/redis/aad/sample-code/java-jedis).
62+
5963
```java
6064
import redis.clients.jedis.DefaultJedisClientConfig;
6165
import redis.clients.jedis.Jedis;
@@ -109,10 +113,13 @@ ms.author: xiaofanzhou
109113
#### [Python](#tab/python)
110114
111115
1. Install dependencies.
116+
112117
```bash
113118
pip install redis azure-identity
114119
```
120+
115121
1. Add the authentication logic with environment variables set by Service Connector. For more information, see [azure-aad-auth-with-redis-py](https://aka.ms/redis/aad/sample-code/python).
122+
116123
```python
117124
import os
118125
import time
@@ -206,11 +213,13 @@ ms.author: xiaofanzhou
206213
#### [Node.js](#tab/nodejs)
207214
208215
1. Install dependencies.
216+
209217
```bash
210218
npm install redis @azure/identity
211219
```
220+
212221
1. Add the authentication logic with environment variables set by Service Connector. For more information, see [Azure Cache for Redis: Microsoft Entra ID with node-redis client library](https://aka.ms/redis/aad/sample-code/js-noderedis).
213-
222+
214223
```javascript
215224
import { createClient } from "redis";
216225
import { DefaultAzureCredential } from "@azure/identity";
@@ -275,4 +284,4 @@ ms.author: xiaofanzhou
275284
276285
### [Other](#tab/none)
277286
278-
For other languages, you can use the Azure Identity client library (and connection information that Service Connector sets to the environment variables) to connect to Azure Cache for Redis.
287+
For other languages, you can use the Azure Identity client library (and connection information that Service Connector sets to the environment variables) to connect to Azure Cache for Redis.

0 commit comments

Comments
 (0)