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
### Create a new Node.js app using Microsoft Entra ID
49
49
50
-
1.Add environment variables for your **Host name** and **Service Principal ID**, which is the object ID your Microsoft Entra ID service principal or user. In the Azure portal, this is shown as the _Username_.
50
+
1.Add environment variables for your **Host name** and **Service Principal ID**, which is the object ID of your Microsoft Entra ID service principal or user. In the Azure portal, this is shown as the _Username_.
51
51
52
-
```cmd
53
-
set AZURE_CACHE_FOR_REDIS_HOST_NAME=contosoCache
54
-
set REDIS_SERVICE_PRINCIPAL_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
55
-
```
52
+
```cmd
53
+
set AZURE_CACHE_FOR_REDIS_HOST_NAME=contosoCache
54
+
set REDIS_SERVICE_PRINCIPAL_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
55
+
```
56
56
57
57
1. Create a new script file named _redistest.js_.
58
-
1. Add the following example JavaScript to the file.
1. Add the following example JavaScript to the file. This code shows you how to connect to an Azure Cache for Redis instance using the cache host name and key environment variables. The code also stores and retrieves a string value in the cache. The `PING` and `CLIENT LIST` commands are also executed. For more examples of using Redis with the [node-redis](https://github.com/redis/node-redis) client, see [https://redis.js.org/](https://redis.js.org/).
112
60
113
-
This code shows you how to connect to an Azure Cache for Redis instance using the cache host name and key environment variables. The code also stores and retrieves a string value in the cache. The `PING` and `CLIENT LIST` commands are also executed. For more examples of using Redis with the [node-redis](https://github.com/redis/node-redis) client, see [https://redis.js.org/](https://redis.js.org/).
@@ -141,83 +140,84 @@ This code shows you how to connect to an Azure Cache for Redis instance using th
141
140
142
141
## Create a sample JavaScript app with reauthentication
143
142
144
-
Microsoft Entra ID access tokens have a limited lifespan, [averaging 75 minutes](../../entra/identity-platform/configurable-token-lifetimes#token-lifetime-policies-for-access-saml-and-id-tokens). In order to maintain a connection to your cache, you need to refresh the token. This example demonstrates how to do this using JavaScript.
143
+
Microsoft Entra ID access tokens have a limited lifespan, [averaging 75 minutes](/entra/identity-platform/configurable-token-lifetimes#token-lifetime-policies-for-access-saml-and-id-tokens). In order to maintain a connection to your cache, you need to refresh the token. This example demonstrates how to do this using JavaScript.
145
144
146
145
1. Create a new script file named _redistestreauth.js_.
147
-
1. Add the following example JavaScript to the file.
@@ -259,15 +259,16 @@ set AZURE_CACHE_FOR_REDIS_HOST_NAME=contosoCache
259
259
set AZURE_CACHE_FOR_REDIS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
260
260
```
261
261
262
-
## Connect to the cache
262
+
###Connect to the cache
263
263
264
264
>[!NOTE]
265
265
> Don't create a new connection for each operation in your code. Instead, reuse connections as much as possible.
266
266
>
267
267
268
-
## Create a new Node.js app
268
+
###Create a new Node.js app
269
269
270
270
1. Create a new script file named _redistest.js_.
271
+
271
272
1. Add the following example JavaScript to the file.
272
273
273
274
```javascript
@@ -353,23 +354,7 @@ set AZURE_CACHE_FOR_REDIS_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
353
354
354
355
---
355
356
356
-
## Clean up resources
357
-
358
-
If you continue to the next tutorial, can keep the resources created in this quickstart and reuse them. Otherwise, if you're finished with the quickstart sample application, you can delete the Azure resources created in this quickstart to avoid charges.
359
-
360
-
> [!IMPORTANT]
361
-
> Deleting a resource group is irreversible and that the resource group and all the resources in it are permanently deleted. Make sure that you do not accidentally delete the wrong resource group or resources. If you created the resources for hosting this sample inside an existing resource group that contains resources you want to keep, you can delete each resource individually instead of deleting the resource group.
362
-
>
363
-
364
-
1. Sign in to the [Azure portal](https://portal.azure.com) and select**Resource groups**.
365
-
366
-
1. In the **Filter by name** text box, enter the name of your resource group. The instructions forthis article used a resource group named _TestResources_. On your resource groupin the result list, select**...**then**Delete resource group**.
@@ -379,4 +364,4 @@ Get the [Node.js quickstart](https://github.com/Azure-Samples/azure-cache-redis-
379
364
380
365
In this quickstart, you learned how to use Azure Cache for Redis from a Node.jsapplication. Continue to the next quickstart to use Azure Cache for Redis with an ASP.NET web app.
381
366
382
-
- [Create an ASP.NET web app that uses an Azure Cache for Redis.](./cache-web-app-howto.md)
367
+
- [Create an ASP.NET web app that uses an Azure Cache for Redis.](cache-web-app-howto.md)
0 commit comments