OnDotNetConfiguration
                                
                                 OnDotNetConfiguration copied to clipboard
                                
                                    OnDotNetConfiguration copied to clipboard
                            
                            
                            
                        A sample ASP.NET Core 5.0 Blazor Server app to accompany the On .NET episodes
OnDotNetConfiguration
A sample ASP.NET Core 5.0 Blazor Server app to accompany Secretless apps with .NET and Azure Key Vault.
Prerequisites
- Yahoo Finance API key from RapidAPI
- .NET SDK 5.0 or later
- Azure subscription
Setup
Local development machine
Before running the project on your machine, store the API key using one of the following approaches:
- 
If using Visual Studio, right-click the BlazorServerConfiguration project in Solution Explorer and select Manage User Secrets. Add the following snippet to the secrets.json file, replacing <API_KEY>with your API key. Save the file."StockOptions": { "ApiKey": "<API_KEY>" }
- 
If not using Visual Studio, replace <API_KEY>in the following command with your API key. Run the command from the directory containing the BlazorServerConfiguration.csproj file.otnet user-secrets set "StockOptions:ApiKey" "<API_KEY>"
Azure resources
To run the project in Azure, complete the following steps:
- 
Deploy the app to Azure App Service. 
- 
Provision an Azure SignalR Service instance with a Service Mode of Default. 
- 
Provision an Azure Key Vault instance. 
- 
In the Key Vault instance, navigate to Settings > Secrets. Create the following secrets by selecting Generate/Import. Name Value Azure--SignalR--ConnectionStringThe primary or secondary SignalR Service connection string found at Settings > Keys. For example, Endpoint=https://blazorserverconfigsignalr.service.signalr.net;AccessKey=<ACCESS_KEY>;Version=1.0;.StockOptions--ApiKeyThe API key obtained from RapidAPI. 
- 
Apply the following changes in App Service: - In Settings > Identity, enable a System-assigned managed identity via the Status toggle button.
- In Settings > Configuration > General settings:
- In the Stack settings section:
- Select .NET from the Stack drop-down list.
- Select .NET 5 from the .NET version drop-down list.
 
- In the Platform settings section, select On for the Web sockets and ARR affinity radio buttons.
 
- In the Stack settings section:
- In Settings > Configuration > Application settings, select New application setting. Create a new environment variable named KEYVAULT_ENDPOINTwhose value is the Key Vault resource's URI (e.g., https://blazorserverconfigvault.vault.azure.net/).