text
stringlengths
0
13.4k
This creates a Resource Group in the West US region. If you're located
far away from the western US, use az account list-locations to get a
list of locations and find one closer to you.
Next, create an App Service plan in the group you just created:
az appservice plan create -g AspNetCoreTodoGroup -n AspNetCoreTodo
Plan --sku F1
F1 is the free app plan. If you want to use a custom domain name
with your app, use the D1 ($10/month) plan or higher.
Now create a Web App in the App Service plan:
az webapp create -g AspNetCoreTodoGroup -p AspNetCoreTodoPlan -n M
yTodoApp
115
Deploy to Azure
The name of the app ( MyTodoApp above) must be globally unique in
Azure. Once the app is created, it will have a default URL in the format:
http://mytodoapp.azurewebsites.net
Deploy your project files to Azure
You can use Git to push your application files up to the Azure Web App.
If your local directory isn't already tracked as a Git repo, run these
commands to set it up:
git init
git add .
git commit -m "First commit!"
Next, create an Azure username and password for deployment:
az webapp deployment user set --user-name nate
Follow the instructions to create a password. Then use config-local-
git to spit out a Git URL:
az webapp deployment source config-local-git -g AspNetCoreTodoGrou
p -n MyTodoApp --out tsv
https://nate@mytodoapp.scm.azurewebsites.net/MyTodoApp.git
Copy the URL to the clipboard, and use it to add a Git remote to your
local repository:
git remote add azure <paste>
You only need to do these steps once. Now, whenever you want to push
your application files to Azure, check them in with Git and run
116
Deploy to Azure
git push azure master
You'll see a stream of log messages as the application is deployed to
Azure.
When it's complete, browse to http://yourappname.azurewebsites.net to
check out the app!
117
Deploy with Docker
Deploy with Docker
If you aren't using a platform like Azure, containerization technologies
like Docker can make it easy to deploy web applications to your own
servers. Instead of spending time configuring a server with the
dependencies it needs to run your app, copying files, and restarting
processes, you can simply create a Docker image that describes