Enable secret storage:
Type “dotnet user-secrets init” into Package Manager Console
<UserSecretsId> can be found in .csproj file.
Set a secret (Package Manager Console):
dotnet user-secrets set “ApiKey” “test123”
or to remove it:
dotnet user-secrets remove “ApiKey”
To check if exists:
dotnet user-secrets list
or
Manage secret through GUI -> right click on project -> Manage User Secrets -> it opens secrets.json
Location of this secrets.json file:
%APPDATA%\Microsoft\UserSecrets\<UserSecretsId>\secrets.json

Sample usage:
DI IConfiguration in constructor:
IConfiguration configuration
Field:
private IConfiguration _configuration;
Use it:
var test = _configuration[“ApiKey”];
Much more info:
https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows