|
1 | 1 | ---
|
2 |
| -title: "Quickstart: Building your first app with App Service Static Apps" |
3 |
| -description: #Required; article description that is displayed in search results. |
4 |
| -services: #Required for articles that deal with a service; service slug assigned to your service by ACOM. |
| 2 | +title: "Quickstart: Building your first static web app with Azure Static Web Apps" |
| 3 | +description: Learn to build an Azure Static Web Apps instance with your preferred front-end framework. |
| 4 | +services: static-web-apps |
5 | 5 | author: craigshoemaker
|
6 |
| -ms.service: azure-functions |
| 6 | +ms.service: static-web-apps |
7 | 7 | ms.topic: quickstart
|
8 | 8 | ms.date: 05/08/2020
|
9 | 9 | ms.author: cshoe
|
10 | 10 | ---
|
11 | 11 |
|
12 |
| -<!---Recommended: Removal all the comments in this template before you sign-off or merge to master.---> |
| 12 | +# Quickstart: Building your first static web app |
13 | 13 |
|
14 |
| -<!---quickstarts are fundamental day-1 instructions for helping new customers use a subscription to quickly try out a specific product/service. The entire activity is a short set of steps that provides an initial experience. |
15 |
| -You only use quickstarts when you can get the service, technology, or functionality into the hands of new customers in less than 10 minutes. |
16 |
| ----> |
| 14 | +Azure Static Web Apps publishes websites to a production environment by building apps from a GitHub repository. In this quickstart, you build a web application using your preferred front-end framework from a GitHub repository. |
17 | 15 |
|
18 |
| -# Quickstart: Building your first static app |
| 16 | +If you don't have an Azure subscription, [create a free trial account](https://azure.microsoft.com/free). |
19 | 17 |
|
20 |
| -<!---Required: |
21 |
| -Starts with "quickstart: " |
22 |
| -Make the first word following "quickstart:" a verb. |
23 |
| ----> |
| 18 | +## Prerequisites |
24 | 19 |
|
25 |
| -Introductory paragraph. |
| 20 | +- [GitHub](https://github.com) account |
| 21 | +- [Azure](https://portal.azure.com) account |
26 | 22 |
|
27 |
| -<!---Required: |
28 |
| -Lead with a light intro that describes, in customer-friendly language, what the customer will learn, or do, or accomplish. Answer the fundamental "why would I want to do this?" question. |
29 |
| ----> |
| 23 | +## Create a repository |
30 | 24 |
|
31 |
| -In this quickstart, you will <do X> |
| 25 | +This article uses GitHub template repositories to make it easy for you to create a new repository. The templates feature starter apps built with different front-end frameworks. |
32 | 26 |
|
33 |
| -If you don't have a <service> subscription, create a free trial account... |
| 27 | +# [Angular](#tab/angular) |
34 | 28 |
|
35 |
| -<!--- Required, if a free trial account exists |
36 |
| -Because quickstarts are intended to help new customers use a subscription to quickly try out a specific product/service, include a link to a free trial before the first H2, if one exists. You can find listed examples in [Write quickstarts](contribute-how-to-mvc-quickstart.md) |
37 |
| ----> |
| 29 | +- Navigate to the following location to create a new repository |
| 30 | + - https://github.com/staticwebdev/angular-basic/generate |
| 31 | +- Name your repository **my-first-static-web-app** |
38 | 32 |
|
39 |
| -<!---Avoid notes, tips, and important boxes. Readers tend to skip over them. Better to put that info directly into the article text.---> |
| 33 | +# [React](#tab/react) |
40 | 34 |
|
41 |
| -## Prerequisites |
| 35 | +- Navigate to the following location to create a new repository |
| 36 | + - https://github.com/staticwebdev/react-basic/generate |
| 37 | +- Name your repository **my-first-static-web-app** |
42 | 38 |
|
43 |
| -- First prerequisite |
44 |
| -- Second prerequisite |
45 |
| -- Third prerequisite |
46 |
| -<!---If you feel like your quickstart has a lot of prerequisites, the quickstart may be the wrong content type - a tutorial or how-to guide may be the better option. |
47 |
| -If you need them, make Prerequisites your first H2 in a quickstart. |
48 |
| -If there's something a customer needs to take care of before they start (for example, creating a VM) it's OK to link to that content before they begin. |
49 |
| ----> |
| 39 | +# [Vue](#tab/vue) |
50 | 40 |
|
51 |
| -## Sign in to <service/product/tool name> |
| 41 | +- Navigate to the following location to create a new repository |
| 42 | + - https://github.com/staticwebdev/vue-basic/generate |
| 43 | +- Name your repository **my-first-static-web-app** |
52 | 44 |
|
53 |
| -<!--Sign in to the [<service> portal](url). ---> |
54 |
| -<!---If you need to sign in to the portal to do the quickstart, this H2 and link are required.---> |
| 45 | +# [No Framework](#tab/vanilla-javascript) |
55 | 46 |
|
56 |
| -## Procedure 1 |
| 47 | +- Navigate to the following location to create a new repository |
| 48 | + - https://github.com/staticwebdev/vanilla-basic/generate |
| 49 | +- Name your repository **my-first-static-web-app** |
57 | 50 |
|
58 |
| -<!---Required: |
59 |
| -Quickstarts are prescriptive and guide the customer through an end-to-end procedure. Make sure to use specific naming for setting up accounts and configuring technology. |
60 |
| -Don't link off to other content - include whatever the customer needs to complete the scenario in the article. For example, if the customer needs to set permissions, include the permissions they need to set, and the specific settings in the quickstart procedure. Don't send the customer to another article to read about it. |
61 |
| -In a break from tradition, do not link to reference topics in the procedural part of the quickstart when using cmdlets or code. Provide customers what they need to know in the quickstart to successfully complete the quickstart. |
62 |
| -For portal-based procedures, minimize bullets and numbering. |
63 |
| -For the CLI or PowerShell based procedures, don't use bullets or numbering. |
64 |
| ----> |
| 51 | +> [!NOTE] |
| 52 | +> Azure Static Web Apps requires at least one HTML file to create a web app. The repository you create in this step includes a single _index.html_ file. |
65 | 53 |
|
66 |
| -Include a sentence or two to explain only what is needed to complete the procedure. |
| 54 | +--- |
67 | 55 |
|
68 |
| -1. Step one of the procedure |
69 |
| -1. Step two of the procedure |
70 |
| -1. Step three of the procedure |
71 |
| - <!---  ---> |
72 |
| - <!---Use screenshots but be judicious to maintain a reasonable length. Make sure screenshots align to the [current standards](contribute-mvc-screen-shots.md). |
73 |
| - If users access your product/service via a web browser the first screenshot should always include the full browser window in Chrome or Safari. This is to show users that the portal is browser-based - OS and browser agnostic.---> |
74 |
| -1. Step four of the procedure |
| 56 | +Click the **Create repository from template** button. |
75 | 57 |
|
76 |
| -## Procedure 2 |
| 58 | +:::image type="content" source="media/getting-started/create-template.png" alt-text="Create repository from template"::: |
77 | 59 |
|
78 |
| -Include a sentence or two to explain only what is needed to complete the procedure. |
| 60 | +## Create a static web app |
79 | 61 |
|
80 |
| -1. Step one of the procedure |
81 |
| -1. Step two of the procedure |
82 |
| -1. Step three of the procedure |
| 62 | +Now that the repository is created, you can create a static web app from the Azure portal. |
83 | 63 |
|
84 |
| -## Procedure 3 |
| 64 | +- Navigate to the [Azure portal](https://portal.azure.com) |
| 65 | +- Click **Create a Resource** |
| 66 | +- Search for **Static Web Apps** |
| 67 | +- Click **Static Web Apps (Preview)** |
| 68 | +- Click **Create** |
85 | 69 |
|
86 |
| -Include a sentence or two to explain only what is needed to complete the procedure. |
| 70 | +### Basics |
87 | 71 |
|
88 |
| -<!---Code requires specific formatting. Here are a few useful examples of commonly used code blocks. Make sure to use the interactive functionality where possible. |
89 |
| -For the CLI or PowerShell based procedures, don't use bullets or numbering.---> |
| 72 | +Begin by configuring your new app and linking it to a GitHub repository. |
90 | 73 |
|
91 |
| -Here is an example of a code block for Java: |
| 74 | +:::image type="content" source="media/getting-started/basics-tab.png" alt-text="Basics tab"::: |
92 | 75 |
|
93 |
| - ```java |
94 |
| - cluster = Cluster.build(new File("src/remote.yaml")).create(); |
95 |
| - ... |
96 |
| - client = cluster.connect(); |
97 |
| - ``` |
| 76 | +- Select your _Azure subscription_ |
| 77 | +- Select or create a new _Resource Group_ |
| 78 | +- Name the app **my-first-static-web-app**. |
| 79 | + - Valid characters are `a-z` (case insensitive), `0-9`, and `_`. |
| 80 | +- Select a _Region_ closest to you |
| 81 | +- Select the **Free** _SKU_ |
| 82 | +- Click the **Sign-in with GitHub** button and authenticate with GitHub |
98 | 83 |
|
99 |
| -or a code block for Azure CLI: |
| 84 | +Once you sign in with GitHub, then enter the repository information. |
100 | 85 |
|
101 |
| - ```azurecli-interactive |
102 |
| - az vm create --resource-group myResourceGroup --name myVM --image win2016datacenter --admin-username azureuser --admin-password myPassword12 |
103 |
| - ``` |
104 |
| - or a code block for Azure PowerShell: |
| 86 | +:::image type="content" source="media/getting-started/repository-details.png" alt-text="Repository details"::: |
105 | 87 |
|
106 |
| - ```azurepowershell-interactive |
107 |
| - New-AzureRmContainerGroup -ResourceGroupName myResourceGroup -Name mycontainer -Image microsoft/iis:nanoserver -OsType Windows -IpAddressType Public |
108 |
| - ``` |
| 88 | +- Select your preferred _Organization_ |
| 89 | +- Select **my-first-web-static-app** from the _Repository_ drop-down |
| 90 | +- Select **master** from the _Branch_ drop-down |
| 91 | +- Click the **Next: Build >** button to edit the build configuration |
109 | 92 |
|
110 |
| -## Clean up resources |
| 93 | +:::image type="content" source="media/getting-started/next-build-button.png" alt-text="Next Build button"::: |
111 | 94 |
|
112 |
| -If you're not going to continue to use this application, delete <resources> with the following steps: |
| 95 | +### Build |
113 | 96 |
|
114 |
| -1. From the left-hand menu... |
115 |
| -2. ...click Delete, type...and then click Delete |
| 97 | +Next, add configuration details specific to your preferred front-end framework. |
116 | 98 |
|
117 |
| -<!---Required: |
118 |
| -To avoid any costs associated with following the quickstart procedure, a Clean up resources (H2) should come just before Next steps (H2) |
119 |
| ----> |
| 99 | +# [Angular](#tab/angular) |
120 | 100 |
|
121 |
| -## Next steps |
| 101 | +- Enter **src** in the _App location_ box |
| 102 | +- Clear the default value from the _Api location_ box |
| 103 | +- Enter **dist/angular-basic** in the _App artifact location_ box |
122 | 104 |
|
123 |
| -<!-- Uncomment this block and add the appropriate link |
| 105 | +# [React](#tab/react) |
124 | 106 |
|
125 |
| -> [!div class="nextstepaction"] |
126 |
| -> [Next steps button](contribute-get-started-mvc.md) |
| 107 | +- Enter **/** in the _App location_ box |
| 108 | +- Clear the default value from the _Api location_ box |
| 109 | +- Enter **build** in the _App artifact location_ box |
| 110 | + |
| 111 | +# [Vue](#tab/vue) |
| 112 | + |
| 113 | +- Enter **/** in the _App location_ box |
| 114 | +- Clear the default value from the _Api location_ box |
| 115 | +- Enter **dist** in the _App artifact location_ box |
| 116 | + |
| 117 | +# [No Framework](#tab/vanilla-javascript) |
| 118 | + |
| 119 | +- Enter **/** in the _App location_ box |
| 120 | +- Clear the default value from the _Api location_ box |
| 121 | +- Clear the default value from _App artifact location_ box |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +Click the **Review + create** button. |
| 126 | + |
| 127 | +:::image type="content" source="media/getting-started/review-create.png" alt-text="Review create button"::: |
| 128 | + |
| 129 | +### Review + create |
| 130 | + |
| 131 | +After the request validates, you can continue to create the application. |
| 132 | + |
| 133 | +Click the **Create** button |
127 | 134 |
|
128 |
| ---> |
| 135 | +:::image type="content" source="media/getting-started/create-button.png" alt-text="Create button"::: |
129 | 136 |
|
130 |
| -<!--- Required: |
131 |
| -Quickstarts should always have a Next steps H2 that points to the next logical quickstart in a series, or, if there are no other quickstarts, to some other cool thing the customer can do. A single link in the blue box format should direct the customer to the next article - and you can shorten the title in the boxes if the original one doesn't fit. |
132 |
| -Do not use a "More info section" or a "Resources section" or a "See also section". ---> |
| 137 | +Once the resource is created, click the **Go to resource** button |
| 138 | + |
| 139 | +:::image type="content" source="media/getting-started/resource-button.png" alt-text="Go to resource button"::: |
| 140 | + |
| 141 | +## View the website |
| 142 | + |
| 143 | +There are two aspects to deploying a static app. The first provisions the underlying Azure resources that make up your app. The second is a GitHub Actions workflow that builds and publishes your application. |
| 144 | + |
| 145 | +Before you can navigate to your new static site, the deployment build must first finish running. |
| 146 | + |
| 147 | +The Static Web Apps overview window displays a series of links that help you interact with your web app. |
| 148 | + |
| 149 | +:::image type="content" source="media/getting-started/overview-window.png" alt-text="Overview window"::: |
| 150 | + |
| 151 | +1. Clicking on the banner that says, "Click here to check the status of your GitHub Actions runs" takes you to the GitHub Actions running against your repository. Once you verify the deployment job is complete, then you can navigate to your website via the generated URL. |
| 152 | + |
| 153 | +2. Once GitHub Actions workflow is complete, you can click on the _URL_ link to open the website in new tab. |
| 154 | + |
| 155 | +## Clean up resources |
| 156 | + |
| 157 | +If you're not going to continue to use this application, you can delete the Azure Static Web Apps instance through the following steps: |
| 158 | + |
| 159 | +1. Open the [Azure portal](https://portal.azure.com) |
| 160 | +1. Search for **my-first-web-static-app** from the top search bar |
| 161 | +1. Click on the app name |
| 162 | +1. Click on the **Delete** button |
| 163 | +1. Click **Yes** to confirm the delete action |
| 164 | + |
| 165 | +## Next steps |
| 166 | + |
| 167 | +> [!div class="nextstepaction"] |
| 168 | +> [Add an API](add-api.md) |
0 commit comments