First you need to create an empty database named, e.g. NRZMyk
and then
a corresponding user:
-- To be executed as admin on master database
CREATE LOGIN nrzmyk WITH password='******';
-- To be executed as admin on NRZMyk database
CREATE USER nrzmyk FROM LOGIN nrzmyk;
EXEC sp_addrolemember 'db_owner', 'nrzmyk';
After changing the connection string in appsettings.json
it should
be possible to apply entity framework migrations.
This app authenticates with Azure ADB2C. In order to run it locally you need to setup client and server apps according to this documentation:
https://docs.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant
Configure the following secrets for the server project:
cd NRZMyk.Server
dotnet user-secrets set "AzureAdB2C:Domain" "Your ADB2C domain"
dotnet user-secrets set "AzureAdB2C:ClientId" "Your server app client ID"
dotnet user-secrets set "AzureAdB2C:SignUpSignInPolicyId" "Your signin policy name"
dotnet user-secrets set "APPINSIGHTS:INSTRUMENTATIONKEY" "Your application insights key"
dotnet user-secrets set "Application:SendGridSenderEmail" "Address used to send messages to other users"
dotnet user-secrets set "Application:SendGridDynamicTemplateId" "Sendgrid dynamic template id"
dotnet user-secrets set "Application:AdministratorEmail" "Address of admin to receive registration requests"
dotnet user-secrets set "SendGrid:ApiKey" "Sendgrid API key"
dotnet user-secrets set "AzureAdB2C:ClientSecret" "Client secret for GraphAPI access"
dotnet user-secrets set "AzureAdB2C:B2cExtensionAppClientId" "B2C extensions app client id"
See also appsettings.json
in server project.
wwwroot/appsettings.json
with corresponding values for the client app.Program.cs
with corresponding API access key.Roles are currently supported by adding a custom attribute to the ADB2C users.
Role
int
Role
enum in server projectFlag based authentication on client side is still WIP.
dotnet tool install --global dotnet-ef
Make sure above mentioned secrets are also set correctly in your deployment environment. Usually this can be done via environment variables:
AzureAdB2C__Domain=contoso.onmicrosoft.com
List migrations in project NRZMyk.Services
using
dotnet ef migrations --startup-project ../NRZMyk.Server/NRZMyk.Server.csproj list
Add a new migration using
dotnet ef migrations --startup-project ../NRZMyk.Server/NRZMyk.Server.csproj add Entity_MigrationDetails