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
### Install the Library for using Entra ID Authentication
53
-
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Entra ID. It is applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
48
+
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Microsoft Entra ID. It's applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
1. Edit the *Web.config* file. Then add the following content:
75
+
1. Edit the _Web.config_ file. Then add the following content:
81
76
82
77
```json
83
78
"_redisHostName":"<cache-hostname>"
84
79
```
85
80
86
-
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview blade of Azure Portal. For example, *my-redis.eastus.azure.net:10000*
81
+
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview section of the Resource menu in the Azure portal. For example, _my-redis.eastus.azure.net:10000_.
87
82
88
83
1. Save the file.
89
84
90
85
For more information, see [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) and the code in a [GitHub repo](https://github.com/StackExchange/StackExchange.Redis).
91
86
92
-
93
87
## Run the sample
94
88
95
-
If you have opened any files, save them and build the app with the following command:
89
+
If you opened any files, save them, and build the app with the following command:
96
90
97
91
```dos
98
92
dotnet build
99
93
```
100
94
101
-
Run the app with the following command to test serialization of .NET objects:
95
+
To test serialization of .NET objects, run the app with the following command:
### Install the Library for using Entra ID Authentication
54
-
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Entra ID. It is applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
53
+
### Install the Library for using Microsoft Entra ID Authentication
54
+
55
+
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Microsoft Entra ID. It's applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview blade of Azure Portal. For example, *my-redis.eastus.azure.net:10000*
92
+
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview from the Resource menu in Azure portal. For example, *my-redis.eastus.azure.net:10000*
### Install the Library for using Entra ID Authentication
65
-
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Entra ID. It is applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
60
+
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Microsoft Entra ID. It is applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview blade of Azure Portal. For example, *my-redis.eastus.azure.net:10000*
For more information, see [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) and the code in a [GitHub repo](https://github.com/StackExchange/StackExchange.Redis).
For more information, see [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) and the code in a [GitHub repo](https://github.com/StackExchange/StackExchange.Redis).
105
108
106
109
## Run the app locally
107
110
108
111
1. Execute the following command in your command window to build the app:
109
112
110
-
```dos
111
-
dotnet build
112
-
```
113
+
```dos
114
+
dotnet build
115
+
```
113
116
114
117
1. Then run the app with the following command:
115
118
116
-
```dos
117
-
dotnet run
118
-
```
119
+
```dos
120
+
dotnet run
121
+
```
119
122
120
123
1. Browse to `https://localhost:5001` in your web browser.
121
124
122
125
1. Select **Azure Cache for Redis Test** in the navigation bar of the web page to test cache access.
123
126
124
-
:::image type="content" source="./media/cache-web-app-aspnet-core-howto/cache-simple-test-complete-local.png" alt-text="Screenshot of simple test completed locally.":::
127
+
:::imagetype="content"source="./media/cache-web-app-aspnet-core-howto/cache-simple-test-complete-local.png"alt-text="Screenshot of simple test completed locally.":::
### Install the Library for using Entra ID Authentication
51
-
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft Entra ID authentication method for connecting to Azure Redis services using Entra ID. It is applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
47
+
The [Azure.StackExchange.Redis](https://www.nuget.org/packages/Microsoft.Azure.StackExchangeRedis) library contains the Microsoft using Microsoft Entra ID authentication method for connecting to Azure Redis services using Microsoft Entra ID. It's applicable to all Azure Cache for Redis, Azure Cache for Redis Enterprise, and Azure Managed Redis (Preview).
1. Using the default Azure credentials to authenticate the client connection. This enables your code to use the signed-in user credential when running locally, and an Azure managed identity when running in Azure without code change.
1. Create a file on your computer named *CacheSecrets.config*. Put it in a location where it won't be checked in with the source code of your sample application. For this quickstart, the *CacheSecrets.config* file is located at *C:\AppSecrets\CacheSecrets.config*.
72
+
1. Create a file on your computer named *CacheSecrets.config*. Put it in a location where it isn't checked in with the source code of your sample application. For this quickstart, the *CacheSecrets.config* file is located at _C:\AppSecrets\CacheSecrets.config_.
77
73
78
74
1. Edit the *Web.config* file. Then add the following content:
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview blade of Azure Portal. For example, *my-redis.eastus.azure.net:10000*
82
+
1. Replace `<cache-hostname>` with your cache host name as it appears in the Overview on the Resource menu in Azure portal. For example, *my-redis.eastus.azure.net:10000*
87
83
88
84
1. Save the file.
89
85
90
86
For more information, see [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) and the code in a [GitHub repo](https://github.com/StackExchange/StackExchange.Redis).
By default, the project is configured to host the app locally in [IIS Express](/iis/extensions/introduction-to-iis-express/iis-express-overview) for testing and debugging.
@@ -123,7 +117,7 @@ After you successfully test the app locally, you can deploy the app to Azure and
123
117
124
118
| Setting | Recommended value | Description |
125
119
| ------- | :---------------: | ----------- |
126
-
| **App name** | Use the default. | The app name is the host name for the app when it's deployed to Azure. The name might have a timestamp suffix added to it to make it unique if necessary. |
120
+
| **App name** | Use the default. | The app name is the host name for the app when deployed to Azure. The name might have a timestamp suffix added to it to make it unique if necessary. |
127
121
| **Subscription** | Choose your Azure subscription. | This subscription is charged for any related hosting costs. If you have multiple Azure subscriptions, verify that the subscription that you want is selected.|
128
122
| **Resource group** | Use the same resource group where you created the cache (for example, *TestResourceGroup*). | The resource group helps you manage all resources as a group. Later, when you want to delete the app, you can just delete the group. |
129
123
| **App Service plan** | Select **New**, and then create a new App Service plan named *TestingPlan*. <br />Use the same **Location** you used when creating your cache. <br />Choose **Free** for the size. | An App Service plan defines a set of compute resources for a web app to run with. |
@@ -132,25 +126,25 @@ After you successfully test the app locally, you can deploy the app to Azure and
132
126
133
127
1. After you configure the App Service hosting settings, select **Create**.
134
128
135
-
1. Monitor the **Output** window in Visual Studio to see the publishing status. After the app has been published, the URL for the app is logged:
129
+
1. Monitor the **Output** window in Visual Studio to see the publishing status. After the app is published, the URL for the app is logged:
136
130
137
131
:::image type="content" source="media/cache-web-app-howto/cache-publishing-output.png" alt-text="Screenshot publishing information in the output pane.":::
138
132
139
133
### Add the app setting for the cache
140
134
141
-
After the new app has been published, add a new app setting. This setting is used to store the cache connection information.
135
+
After the new app is published, add a new app setting. This setting is used to store the cache connection information.
142
136
143
137
#### To add the app setting
144
138
145
-
1. Type the app name in the search bar at the top of the Azure portal to find the new app you created.
139
+
1. To find the new app you created, type the app name in the search bar at the top of the Azure portal.
146
140
147
141
:::image type="content" source="media/cache-web-app-howto/cache-find-app-service.png" alt-text="Screenshot showing how to find the app on the Azure portal.":::
148
142
149
143
2. Add a new app setting named **CacheConnection** for the app to use to connect to the cache. Use the same value you configured for `RedisHostName` in your *web.config* file.
150
144
151
145
### Run the app in Azure
152
146
153
-
1. In your browser, go to the URL for the app. The URL appears in the results of the publishing operation in the Visual Studio output window. It's also provided in the Azure portal on the overview page of the app you created.
147
+
1. In your browser, go to the URL for the app. The URL appears in the results of the publishing operation in the Visual Studio output window. The URL is also provided in the Azure portal on the overview page of the app you created.
154
148
155
149
1. Select **Azure Cache for Redis Test** on the navigation bar to test cache access as you did with the local version.
0 commit comments