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
Admin tools for [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) using Blazor Single Page Application (webassembly).
6
+
Admin tools for [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) using [Blazor Single Page Application (webassembly)](https://azure.microsoft.com/services/app-service/static/?WT.mc_id=dotnet-0000-frbouche).
7
+
8
+
The project is now at version 1 and ready to be used! ~~just getting started but should have a v1 ready in Summer 2020~~. It is using Azure Active Directory (AAD) as authentication for the user and to connect to the API (Azure Function).
9
+
10
+
![Tiny Blazor Admin home page][tinyBA_home]
11
+
12
+
Once authenticated you can manage your URLs and see some statistics. Thanks to [Syncfusion](https://www.syncfusion.com/blazor-components) for the community licences. Everyone can use Tiny Blazor Admin with that great look!
The project is now at version 1 and ready to be use! ~~just getting started but should have a v1 ready in Summer 2020~~. It will use Azure Active Directory (AAD) as authentication for the user and to connect to the API (Azure Function).
11
19
12
20
# Deployment
13
21
14
-
Until an automatic deployment is created, you will need to deploy some part manually. [All the steps to deploy the TinyBlazorAdmin app into Azure are listed here](deployment.md). You can also run it somewhere else if you prefer, even locally.
22
+
Until an automatic deployment is created, you will need to deploy some part manually. [All the steps to deploy the TinyBlazorAdmin app into Azure are listed here](deployment.md). You can also run it somewhere else if you prefer, even locally.
15
23
16
24
17
25
@@ -23,7 +31,9 @@ To see the current work in progress: [GLO boards](https://app.gitkraken.com/glo/
23
31
24
32
25
33
[TinyBlazorAdmin]: medias/TinyBlazorAdmin.png
26
-
34
+
[tinyBA_home]: medias/tinyBA_home.png
35
+
[inyBA_stats]: medias/inyBA_stats.png
36
+
[inyBA_urls]: medias/inyBA_urls.png
27
37
28
38
## Contributors ✨
29
39
@@ -36,11 +46,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Until an automatic deployment is created here is the steps to deploy the TinyBlazorAdmin app into Azure. You can run it somewhere else and even locally.
3
+
Until a "full automatic" deployment is created, here are all the steps to deploy the TinyBlazorAdmin app into Azure. You can run it somewhere else and even locally.
4
4
5
-
## Create the Backend
5
+
## First thing first
6
6
7
-
This project is a frontend only so you will need to deploy the [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) in "headless mode". Do to it click the blue button below and make sure to select **none** as Frontend
7
+
You need to **fork this repo** into your own account. You will need to update the configuration (this document will explain when and what), therefore it needs to be yours.
8
8
9
-
[](https://portal.azure.com/?WT.mc_id=urlshortener-github-frbouche#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FFBoucher%2FAzUrlShortener%2Fmaster%2Fdeployment%2FazureDeploy.json)
9
+
To fork a GitHub repository click on the fork button on the top right of the screen. If you need more detail have a look to this GitHub doc: [Fork a repo
This project is a frontend only so you will need to deploy the [Azure Url Shortener](https://github.com/FBoucher/AzUrlShortener) in "headless mode". Do to it, click the blue button below and make sure to select **none** as Frontend
15
+
16
+
[](https://portal.azure.com/?WT.mc_id=urlshortener-github-frbouche#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FFBoucher%2FAzUrlShortener%2Fmain%2Fdeployment%2FazureDeploy.json)
10
17
11
18
![CreateBackend][CreateBackend]
12
19
20
+
21
+
## Deploy TinyBlazorAdmin (the Frontend)
22
+
23
+
There are many ways you could run Tiny Blazor Admin website. In this deployment, we will use the new [Azure Static Web App (SWA)](https://azure.microsoft.com/en-ca/services/app-service/static/?WT.mc_id=tinyblazoradmin-github-frbouche). However, because the TinyBlazorAdmin use Azure Active Directory (AAD), we need a standalone Azure Function (deployed at the previous step).
24
+
25
+
Open Azure portal (portal.azure.com), open the **resource group** where you created the backend (ex: streamDemo is our case). Click the "**+**" and search **Static Web App**, and click the *Create* button.
26
+
27
+
![Creating swa][swa_create1]
28
+
29
+
> Note: You will need to **Authorize Azure Static Web Apps**, to have access to _your_ GitHub repository (the one created when you forked the project). This is required because SWA uses GitHub Action to deploy.
30
+
31
+
![Creating swa part 2][swa_create2]
32
+
33
+
Select your organization, repository and branch (ex: main).
34
+
35
+
![Creating swa part 3][swa_create3]
36
+
37
+
Select **Blazor** as your *Build Presets*. The *App location* needs to be the location of the project file; in our case `src/TinyBlazorAdmin/`. The *App artifact location* can be left to wwwroot.
38
+
39
+
>Note: We don't need the Api location, because AzURLShortener is deployed in a full standalone Azure Function.
40
+
41
+
Once it's all filled, click the Review, and create button. It will takes a few minutes to get deployed. During this time let's create and configure our security components.
42
+
13
43
## Create Azure Active Directory (AAD) Components
14
44
15
-
### Create App for the Fontend
45
+
### Create AAD App for the Fontend
46
+
47
+
We need a Service Principal that we will use to authenticate our user to Azure Active Directory (AAD). To achieve this we will create an application registration in Azure.
48
+
49
+
From the Azure Portal (portal.azure.com), open the **Azure Active Directory** page. From the left option menu select **App registrations**, then create a new registration. Use a name that will help you to remember that it's for the TinyBlazorAdmin website (ex: TinyAdminApp) (1)
16
50
17
-
We need a Service Principal that we will use to authenticate our user to Azure Active Directory (AAD). To accheive this we will create a application registration in Azure.
51
+
![RegisterClientApp][RegisterClientApp]
18
52
19
-
From the Azure Portal (portal.azure.com), open the **Azure Active Directory** page. From the left option menu select **App registrations**, then create a new registration. Use a name that will helps you to remember that it's for the TinyBlazorAdmin website (ex:
20
-
TinyAdminApp)
53
+
For the Redirect URL use **Web** (3) and enter the URL of the Azure Static WebApp deployed previously and add `/authentication/login-callback`. It should look lsomething like this:
If you need to retreive the ClientID and TenantID, they will be diplay at the top of the page once you select an app in the portal.
62
+
If you need to retrieve the ClientID and TenantID, they will be display at the top of the page once you select an app in the portal.
25
63
26
64
![Create a new registration][newRegistration]
27
65
66
+
Go back in the Authentication and in the section Implicit grant check the checkbox `Access Token` and `ID Tokens`
67
+
68
+
![tokensaccess][tokensaccess]
28
69
29
70
### Create App for the Azure Function
30
71
31
-
We need a second App registration, this time to let the Azure Function validate that user information contain into the token is valid.
72
+
We need a second App registration, this time to let the Azure Function validate that user information contained in the token is valid.
32
73
33
74
![First steps to create the AD App registration][azFunction_Auth_step1]
34
75
@@ -40,9 +81,9 @@ From the Azure Portal, go to your Azure Function. From the left panel select the
40
81
2. Make sure *Create New AD App* is selected.
41
82
3. Give the AD App a name.
42
83
4. Click Ok.
43
-
5. DON"T FORGET TO CLICK THE SAVE BUTTON
84
+
5. DON'T FORGET TO CLICK THE SAVE BUTTON
44
85
45
-
Now, we need to configure the brandnew Ad App registration. Still from the Azure portal open the *Active Directory* blade. Select the *App registration* option from the left menu. Then select the application you just created.
86
+
Now, we need to configure the brand-new Ad App registration. Still from the Azure portal open the *Active Directory* blade. Select the *App registration* option from the left menu. Then select the application you just created.
46
87
47
88
![ConfigAzFuncADapp][ConfigAzFuncADapp]
48
89
@@ -53,31 +94,46 @@ Now, we need to configure the brand new Ad App registration. Still from the Azur
53
94
5. Save by clicking *Add application*.
54
95
55
96
56
-
## Deploy TinyBlazorAdmin
57
-
58
-
(more details to come but here are the steps)
59
-
60
-
- create a storage account
61
-
- set it to static website
62
-
- Copy artifact from /deployment folder.
63
97
64
98
## Configure Backend and Frontend to Work Together
65
99
100
+
Now in your GitHub it's time to update the settings. The code needs to know the AD app to use and the Azure Function to call. Update those values inside `TinyBlazorAdmin\wwwroot\appsettings.json`
66
101
67
-
And update those values inside `TinyBlazorAdmin\wwwroot\appsettings.json`
First we need the url of the caller (aka TinyBlazorAdmin). From the Azure Portal, open the TinyBlazorAdmin SWA blade. Note the URL display in the top right of the page this is the URL of your admin page.
79
121
122
+
![swa_URL][swa_URL]
80
123
124
+
Now we need to add this URL to the list in the CORS of the Azure Function that run AzUrlShortener. From the Azure portal open the blade of AzUrlShortener. From the left menu search CORS, and click it. Add the URL of the SWA and don't forget to save.
125
+
126
+
127
+
![azFunction_CORS][azFunction_CORS]
128
+
129
+
## Try it!
130
+
131
+
Voila, the deployment is now completed. You can test it by creating a new short URL using the admin SWA.
132
+
133
+
134
+
## Adding Custom Domain
135
+
136
+
To add a custom domain to your AzUrlShortener & TinyBlazorAdmin, [follow these steps](https://github.com/FBoucher/AzUrlShortener/blob/main/post-deployment-configuration.md#add-a-custom-domain) from the the AzUrlShortener repo.
81
137
82
138
83
139
[CreateBackend]: medias/CreateBackend.png
@@ -88,4 +144,9 @@ And update those values inside `TinyBlazorAdmin\wwwroot\appsettings.json`
Copy file name to clipboardExpand all lines: deployment/wwwroot/_content/Microsoft.AspNetCore.Components.WebAssembly.Authentication/AuthenticationService.js
0 commit comments