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/workshop.md
+36-7Lines changed: 36 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ This will start the creation of a dev container environment, which is a pre-conf
122
122
123
123
<divclass="info"data-title="note">
124
124
125
-
> You don't have to worry about Codespaces usage cost for this workshop, as it's free for forks of our template repository. For personal usage, Codespaces includes up to 60 hours of free usage per month for all GitHub users, see [the pricing details here](https://github.com/features/codespaces).
125
+
> Codespaces includes up to 60 hours of free usage per month for all GitHub users, see [the pricing details here](https://github.com/features/codespaces).
126
126
127
127
</div>
128
128
@@ -1517,8 +1517,15 @@ Create a new file named `staticwebapp.config.json` in the `packages/website/publ
1517
1517
}
1518
1518
```
1519
1519
1520
-
TODO:complete
1521
-
TODO:raiseissueabouttherewrite
1520
+
We're defining two things here: the routing rules, and the navigation fallback. We add a routing rules to only allow access to our API to authenticated users. SWA provides two built-in roles: `authenticated` and `anonymous`. We use the `authenticated` role here, because we want to make sure that only authenticated users can access our API. If a user tries to access our API without being authenticated, it will return a `401 Unauthorized` response.
1521
+
1522
+
<div class="info" data-title="info">
1523
+
1524
+
> Routing options also allows to define redirections, rewriting, caching headers, and more. See the [documentation](https://learn.microsoft.com/azure/static-web-apps/configuration) for more details.
1525
+
1526
+
</div>
1527
+
1528
+
The navigation fallback is used to redirect all requests to unknown resources to the `index.html` file. This is mandatory for single-page applications, though we'reonlyusingitheretomakesurethatyoualwaysendupontheindexpage.
1522
1529
1523
1530
### SettinguptheSWACLI
1524
1531
@@ -1565,8 +1572,6 @@ Then, we'll add a new `start` script to our `package.json` file to start the SWA
1565
1572
},
1566
1573
```
1567
1574
1568
-
TODO:clifix:vite+apidevserverurlquestion
1569
-
1570
1575
### Testingourapplication
1571
1576
1572
1577
We're now ready to test our whole application locally. To do so, we need to start in parallel the SWA CLI and the Docker compose environment with our services.
@@ -1618,7 +1623,7 @@ You should see the login page of our application:
1618
1623
1619
1624
If you select **Login**, you'll be redirected to the SWACLI authentication emulator login page:
1620
1625
1621
-

1626
+

1622
1627
1623
1628
This is a fake login page made for local testing, where you can enter various parameters to simulate different users. Fillin any **Username** and select **Login**.
1624
1629
@@ -1633,7 +1638,31 @@ After you're done testing, you can stop the application by pressing `Ctrl+C` in
1633
1638
---
1634
1639
1635
1640
## Azure setup
1636
-
- Setup azure account: script: explain what it does
1641
+
1642
+
Azure is a cloud platform that provides a wide range of services to build, deploy, and manage applications. We'll use various Azure services inthis workshop to host our application.
1643
+
1644
+
First, you need to make sure you have an Azure account. If you don't have one, you can create a free account including Azure credits on the [Azure website](https://azure.microsoft.com/free/).
1645
+
1646
+
<div class="important" data-title="important">
1647
+
1648
+
> If you're following this workshop in-person at SnowCamp, you can use the following link to get a 50$ Azure Pass credit: [redeem your Azure Pass](https://azcheck.in/sno230125)
1649
+
1650
+
</div>
1651
+
1652
+
Once you have your Azure account, open a terminal at the root of the project and run:
1653
+
1654
+
```bash
1655
+
.azure/setup.sh
1656
+
```
1657
+
1658
+
This script uses the [Azure CLI](https://learn.microsoft.com/cli/azure) and [GitHub CLI](https://cli.github.com/) to do the following:
1659
+
- Login into your Azure account
1660
+
- Select a subscription to use
1661
+
- Create a [service principal](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal), a token that will be used to create or update resources in Azure
1662
+
- Login into your GitHub account
1663
+
- Add the `AZURE_CREDENTIALS` secret to your GitHub repository, with your the service principal token
0 commit comments