Skip to content

Site Apis

Suwat Ch edited this page Jun 29, 2020 · 21 revisions

List sites

ARMClient.exe get /subscriptions/{subscription}/providers/Microsoft.Web/sites?api-version=2014-11-01

Get a site

ARMClient.exe get /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}?api-version=2014-11-01

Create or Update Site

ARMClient.exe put /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}?api-version=2015-02-01 @payload.json

Example payload.json below

{
  "location": "{location}",
  "properties": {
    "serverFarm": "{serverFarm}",
    "hostingEnvironment": "{hostingEnvironment}" (OPTIONAL)
  }
}
{
  "location": "{location}",
  "properties": {
    "serverFarm": "{serverFarm}",
    "siteConfig": {
      "appSettings": [
        { "name": "foo1", "value": "bar2" },
        { "name": "foo2", "value": "bar2" }
      ]
    }
  }
}

Stop Site

ARMClient.exe post /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}/stop?api-version=2014-11-01

-OR-

ARMClient.exe put /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}?api-version=2014-11-01 @payload.json

// stop main (but not SCM) site
payload.json
{
  "location": "{location}",
  "properties": { "State":"Stopped" }
}

// stop both main and SCM sites
payload.json
{
  "location": "{location}",
  "properties": { "State":"Stopped", ScmSiteAlsoStopped: true } 
}

Start Site

ARMClient.exe pst /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}/start?api-version=2014-11-01

-OR-

ARMClient.exe put /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}?api-version=2014-11-01 @payload.json

payload.json
{
  "location": "{location}",
  "properties": { "State":"Running" }
}

Delete Site

ARMClient.exe delete /subscriptions/{subscription}/resourceGroups/{resourceGroup}/providers/Microsoft.Web/sites/{site}?api-version=2014-11-01
Clone this wiki locally