39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
|
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();
|