2

Here is my bicep template to deploy App service. Need help to add a slot with name: 'staging' (settings to be cloned from parent)

resource appServicePlan 'Microsoft.Web/serverfarms@2020-06-01' = {
  name: appServicePlanName
  location: location
  properties: {
    reserved: true
  }
  sku: {
    name: sku
  }
  kind: 'linux'
}
resource appService 'Microsoft.Web/sites@2020-06-01' = {
  name: webAppName
  location: location
  properties: {
    serverFarmId: appServicePlan.id
    siteConfig: {
      linuxFxVersion: linuxFxVersion
    }
  }
}
Krish
  • 51
  • 6

1 Answers1

4

You are looking for the Microsoft.Web sites/slots resource. Here a minimal example:

resource stagingSlot 'Microsoft.Web/sites/slots@2021-02-01' = {
  name: 'staging'
  parent: yourparent
  location: location
  kind: 'app'
  properties: {
    serverFarmId: appService.id
  }
}
Martin Brandl
  • 56,134
  • 13
  • 133
  • 172
  • Ran into these errors but got your solution working after making minor tweaks. Thank you! [{"code":"NotFound","message":"{\r\n \"error\": {\r\n \"code\": \"ParentResourceNotFound\",\r\n \"message\": \"Can not perform requested operation on nested resource. Parent resource 'slotsdemo' not found.\"\r\n }\r\n}"}]}} Error BCP170: Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully-qualified name. – Krish Oct 24 '22 at 08:40
  • Thank you, it worked with minor tweaks. name: 'staging' location: location kind: 'app' parent: appService properties: { serverFarmId: appServicePlan.id } } – Krish Oct 24 '22 at 14:58