Day 4 of 5
⏱ ~60 minutes
Azure in 5 Days — Day 4

Azure App Service

Deploy a web app from GitHub, configure environment variables, use deployment slots for staging, and add a custom domain.

Create an App Service

Azure CLI
# Create an App Service Plan (the VM running your app)
az appservice plan create \
  --name myapp-plan --resource-group myapp-rg \
  --sku B1 --is-linux

# Create the web app
az webapp create \
  --resource-group myapp-rg --plan myapp-plan \
  --name my-unique-app-name \
  --runtime 'NODE:20-lts'

# Deploy from GitHub
az webapp deployment source config \
  --name my-unique-app-name --resource-group myapp-rg \
  --repo-url https://github.com/you/your-repo \
  --branch main --manual-integration
Environment Variables
# Set app settings (environment variables)
az webapp config appsettings set \
  --resource-group myapp-rg --name my-unique-app-name \
  --settings \
    DATABASE_URL='...' \
    API_KEY='...' \
    NODE_ENV='production'
Deployment Slots
# Create a staging slot
az webapp deployment slot create \
  --name my-unique-app-name --resource-group myapp-rg \
  --slot staging

# Deploy to staging first
az webapp deployment source config \
  --name my-unique-app-name --resource-group myapp-rg \
  --slot staging --repo-url ... --branch main

# Swap staging to production (zero-downtime)
az webapp deployment slot swap \
  --name my-unique-app-name --resource-group myapp-rg \
  --slot staging --target-slot production
💡
Deployment slots are powerful. Deploy to staging, run smoke tests, then swap. If something breaks, swap back. Zero downtime, instant rollback.
📝 Day 4 Exercise
Deploy a Node App to App Service
  1. C
  2. r
  3. e
  4. a
  5. t
  6. e
  7. a
  8. n
  9. A
  10. p
  11. p
  12. S
  13. e
  14. r
  15. v
  16. i
  17. c
  18. e
  19. P
  20. l
  21. a
  22. n
  23. a
  24. n
  25. d
  26. w
  27. e
  28. b
  29. a
  30. p
  31. p
  32. .
  33. D
  34. e
  35. p
  36. l
  37. o
  38. y
  39. a
  40. N
  41. o
  42. d
  43. e
  44. o
  45. r
  46. P
  47. y
  48. t
  49. h
  50. o
  51. n
  52. a
  53. p
  54. p
  55. f
  56. r
  57. o
  58. m
  59. G
  60. i
  61. t
  62. H
  63. u
  64. b
  65. .
  66. S
  67. e
  68. t
  69. e
  70. n
  71. v
  72. i
  73. r
  74. o
  75. n
  76. m
  77. e
  78. n
  79. t
  80. v
  81. a
  82. r
  83. i
  84. a
  85. b
  86. l
  87. e
  88. s
  89. v
  90. i
  91. a
  92. C
  93. L
  94. I
  95. .
  96. C
  97. r
  98. e
  99. a
  100. t
  101. e
  102. a
  103. s
  104. t
  105. a
  106. g
  107. i
  108. n
  109. g
  110. s
  111. l
  112. o
  113. t
  114. ,
  115. d
  116. e
  117. p
  118. l
  119. o
  120. y
  121. t
  122. o
  123. i
  124. t
  125. ,
  126. v
  127. e
  128. r
  129. i
  130. f
  131. y
  132. i
  133. t
  134. w
  135. o
  136. r
  137. k
  138. s
  139. ,
  140. t
  141. h
  142. e
  143. n
  144. s
  145. w
  146. a
  147. p
  148. t
  149. o
  150. p
  151. r
  152. o
  153. d
  154. u
  155. c
  156. t
  157. i
  158. o
  159. n
  160. .

Day 4 Summary

  • App Service runs web apps without managing VMs. Supports Node, Python, PHP, .NET, Java.
  • Environment variables in App Service = az webapp config appsettings set. Never hardcode secrets.
  • Deployment slots enable zero-downtime deployments with instant swap and rollback.
  • B1 plan is the smallest paid tier ($13/mo). Free tier (F1) has limited CPU — fine for dev.
Finished this lesson?