How to shut down an Azure static web app?

Viewed 1330

I created an Azure static web app from a new project template and it automatically built and deployed it live. This is nice, but I'd like to be able to shut it down until I'm actually ready to go live with my site. I don't see a way to control anything like this in the options.

4 Answers

There no CLI command to shutdown the app, but you could play with the routing configuration (public folder) and add a route to display a page that hides the concept of what you are working on.

 {
    "route": "/*",
    "serve": "/in-progress.html",
    "statusCode": 200
  }

I prefer to secure the app by forcing a login using azure ad and adding routes with the authenticated policy.

 {
    "route": "/",
    "allowedRoles": ["authenticated"]
  },     
  {
    "route": "/public",
    "allowedRoles": ["authenticated"]
  }
  {
    "route": "/login",
    "serve": "/.auth/login/aad"
  },

I am afraid that there is no such option available for now as Azure Static Web Apps is currently in preview.

You can check Azure CLI commands for Azure Static Web Apps in this document.

Currently I am working on a static web app and has the same requirement. How I handled this is by adding 2 code branches, ci and master. I commit all my changes to ci till I am not ready. I have 2 static web apps, one is based on ci and other on master. This let me test it in real time and when I am ready I will merge the code which in turn will be pushed into my production web app.

Related