Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand

General instructions for setting App settings and connection strings

  • Open the App Service that you want to set values for
  • On the left menu find the "Configuration" option
  • There will be an option towards the top of the screen to create new AppSettings and one at the bottom to bulk-edit connection strings
  • After adding or changing values make sure to save the app service.

WebApi application settings

  • The webApi should have an Application Setting of “AppSettings“ApiSettings:Mode” and a Value of “YearSpecific”
  • The webApi should have an Application Setting of "ApplicationInsights:InstrumentationKey" and the value should come from the Instrumentation key from your App Insight

Ex

Admin App application settings

  • The Admin App should have an Application Setting of “AppSettings:ProductionApiUrl” and a Value of the URL for the Web API

Swagger application settings

  • Swagger App should have an Application Setting of ““WebApiVersionUrl”” and a Value of the URL for the Web API

NOTE: Make sure when you finish adding the settings you save the changes

Configure Database Connection

There are two methods of database configuring database connection strings we are describing. The first one has the database credentials hardcoded in the settings for that App Service. This is a violation of some organization's security policy. The second method uses the key vault set up in step 4 to hold the credentials.

Deck
idConfigure database connection


Card
labelCredentials hard coded in the connection string

In this section, we will configure AdminApp and WebApi connection strings directly.

WebApi

  • From the azure portal home page, search for App Services
  • Select the WebApi App Service
  • Go to select Settings => Configuration
  • Under the Connection string section, select Advance Edit
  • Paste the following code into the text area that is prompted, replacing the Server, User Id, and Passwords with the details for the Azure Sql Server.
Code Block
languagejs
[
  {
    "name": "EdFi_Admin",
    "value": "Server=<Your SQL server name here>; Database=EdFi_Admin; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  },
  {
    "name": "EdFi_Ods",
    "value": "Server=<Your SQL server name here>; Database=EdFi_{0}; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  },
  {
    "name": "EdFi_Security",
    "value": "Server=<Your SQL server name here>; Database=EdFi_Security; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  }
]


Admin App

  • From the azure portal home page, search for App Services
  • Select the Admin App app service
  • Go to select Settings => Configuration
  • Under the Connection string section, select Advance Edit
  • Paste the following code into the text area that is prompted, replacing the Server, User Id, and Passwords with the details for the Azure Sql Server.
Code Block
languagejs
[
  {
    "name": "Admin",
    "value": "Server=<Your SQL server name here>; Database=EdFi_Admin; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  },
  {
    "name": "ProductionOds",
    "value": "Server=<Your SQL server name here>; Database=EdFi_{0}; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  },
  {
    "name": "Security",
    "value": "Server=<Your SQL server name here>; Database=EdFi_Security; User Id=<Your SQL username here>; Password= <your SQL Password here>; Application Name=EdFi.Ods.WebApi;",
    "type": "SQLAzure",
    "slotSetting": false
  }
]



Card
labelUsing Key vault

In this section, we will configure AdminApp and WebApi to pull the database connection string from the key vault

Prerequisite: you must have followed the instruction in step 4 on how to set up the azure key vault

  • From the azure portal home page, search for App Services
  • Select the App service on which you have the WebApi configured
  • Inside WebApi Service, select Settings => Configuration
  • Under the Connection string section, select Advance Edit
  • Paste the following code into the text area that is prompted
Code Block
languagejs
[
 {
   "name": "EdFi_Admin",
   "value": "@Microsoft.KeyVault(SecretUri={Secret Identifier})",
   "type": "SQLAzure",
   "slotSetting": false
 },
 {
   "name": "EdFi_Ods",
   "value": "@Microsoft.KeyVault(SecretUri={Secret Identifier})",
   "type": "SQLAzure",
   "slotSetting": false
 },
 {
   "name": "EdFi_Security",
   "value": "@Microsoft.KeyVault(SecretUri={Secret Identifier})",
   "type": "SQLAzure",
   "slotSetting": false
 }
]

Configure the following properties inside the above JSON

  • value: "{Secret Identifier}"  must be replaced with the secret identifier value that is auto-generated from the secret (Step 4.2)

  • name: must match the name of the database that you have in your appsettings.json 

Once done, you will end up with something similar to this 


  • Once done and verified that everything is correct, save the changes

Important: Repeat all the above steps for AdminApp



...