39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
// <snippet_ProgramConfigurations>
|
|
using Azure.Identity;
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
using Microsoft.Extensions.Azure;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
var BlobStorageUri = builder.Configuration["AzureURIs:BlobStorage"];
|
|
var KeyVaultURI = builder.Configuration["AzureURIs:KeyVault"];
|
|
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddHttpClient();
|
|
builder.Services.AddServerSideBlazor();
|
|
|
|
builder.Services.AddAzureClientsCore();
|
|
|
|
builder.Services.AddDataProtection()
|
|
.PersistKeysToAzureBlobStorage(new Uri(BlobStorageUri),
|
|
new DefaultAzureCredential())
|
|
.ProtectKeysWithAzureKeyVault(new Uri(KeyVaultURI),
|
|
new DefaultAzureCredential());
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapRazorPages();
|
|
|
|
app.Run();
|
|
// </snippet_ProgramConfigurations> |