You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/10-publish-and-deploy.md
+84-18Lines changed: 84 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,43 +16,109 @@ Right-click on the Server project in the solution and select Publish. The ASP.NE
16
16
17
17

18
18
19
-
In the "Pick a publish target" dialog:
20
-
- Select "App Service"
21
-
- Select the "Create New" option
22
-
- Select "Create Profile" in the button drop down before clicking it
19
+
In the Publish wizard, select "Azure" and then select Next:
23
20
24
-

21
+

22
+
23
+
Select "Azure App Service (Windows)" for the specific target, and then select Next:
24
+
25
+

26
+
27
+
Wait for your subscriptions to load, and then select the subscription to use for the Azure App Service. After selecting your subscription, select "Create a new Azure App Service..." at the bottom of the dialog.
28
+
29
+

30
+
31
+
In the "App Service: Create New" dialog:
25
32
26
-
In the "Create App Service" dialog:
27
33
- Make sure that the correct account that you want to use for your new Azure App Service is selected in the account drop down in the upper right
28
34
- Pick a unique name for your app (which becomes part of the app's default URL)
29
35
- Select the Azure subscription you want to use along with the Resource Group and Hosting Plan
30
36
- Resource groups are a convenient way to group related resources on Azure, so consider creating one specific to the pizza store app.
31
-
- For the hosting plan, using a free plan is fine.
37
+
- For the hosting plan, you'll need to select a Basic tier hosting plan or higher.

34
40
35
-
At this point you could also create a production database for your app. Since the app uses SQLite and deploys its own database, creating a database isn't necessary, but for a real app it would be.
41
+
Click Create to create the app service. This may take a couple of minutes.
36
42
37
-
Click Create to create the App Service. This may take a couple of minutes. Once the App Service is created you should see your publish profile in the Publish page:
43
+
Once the app service has been created, make sure it is selected and then click Finish in the Publish dialog
Before we publish, we first we need to do some configuration for our app to run. The pizza store app requires a Twitter app consumer key and secret to handle authentication. During development, these values are stored in `appsettings.Development.json`. We need to configure these values in the App Service environment, or the app will fail to run.
47
+
Once the App Service is created you should see your publish profile in the Publish page:
42
48
43
-
To register your app service as a Twitter app, you'll need to use the [Twitter Developer Console](https://developer.twitter.com/apps) and signup up for a Twitter developer account. Or you can use dummy values for now, which will break authentication, but at least allow the app to run.
Click on the "Edit App Service Settings" link. Add two settings: `Authentication:Twitter:ConsumerKey`, and `Authentication:Twitter:ConsumerSecret`. Specify the correct values for your Twitter app, or just put in some dummy strings if you don't care about getting authentication working. Click OK to save the app settings.
51
+
At this point you could create a production database for your app. Since the app uses SQLite and deploys its own database, creating a database isn't necessary, but for a real app it would be.
If we publish the app at this point, it will return a server error and fail to start. This is because we first need to configure a signing key for IdentityServer. During development, we used a development key (see *BlazingPizza.Server/appsettings.Development.json*), but in production we need to configure an actual certificate for issuing tokens. We'll do that using Azure Key Vault.
48
54
49
-
You're ready to publish! Click Publish.
55
+
## Setup a signing certificate with Azure Key Vault
56
+
57
+
You can create a signing certificate using an existing key vault, or create a new one.
58
+
59
+
To create a new key vault:
60
+
61
+
- Sign in to the Azure portal at https://portal.azure.com.
62
+
- From the Azure portal menu, or from the Home page, select **Create a resource**.
63
+
- In the Search box, enter **Key Vault**.
64
+
- From the results list, choose **Key Vault**.
65
+
- On the Key Vault section, choose **Create**.
66
+
- On the **Create key vault** section, provide the following information:
67
+
-**Name**: A unique name is required.
68
+
-**Subscription**: Choose your subscription.
69
+
-**Resource Group**: Choose the resource group for your key vault.
70
+
- In the **Location** pull-down menu, choose a location.
71
+
- Leave the other options to their defaults.
72
+
- After providing the information above, select **Create**.
73
+
74
+
Browse to your key vault in the Azure portal and select **Certificates**. Select **Generate/Import** to create a new certificate.
Browse to your app service in the portal, select **TLS/SSL Settings**. Select the **Private Key Certificates (.pfx)** tab and then select **Import Key Vault Certificate**.
Select **Configuration** in the left nav for the app service. Add the `WEBSITE_LOAD_CERTIFICATES` application setting with its value set to the certificate thumbprint you copied previously. This setting will make the certificate available to your app using the Windows certificate store.
0 commit comments