1

We are creating an Azure Web App using the command line interface. How do we create a server farm from the CLI? This is what we have already done.

azure login
azure group create MyGroup "West US"
azure webapp create -g MyGroup -n MyApp -l "West US"

The error is:

parameters.webSite.properties.serverFarm cannot be null.

How do we create a server farm from the CLI? Here are some things we have tried.

azure resource create -g MyGroup -n MyFarm 
    -r "Microsoft.Web/ServerFarms" -l "West US" -o "2015-08-01" 
    -p "{ `"SKU`": `"`" }"

We have not been able to determine how to set the -p value with an appropriate JSON object. Azure complains about unexpected characters. None of these work.

-p "{ sku: "" }"          // Unexpected token s
-p "{ 'sku': "" }"        // Unexpected token '
-p "{ \'sku\' : \'\' }"   // uUnexpected token \
-p "{ `'sku`' : `'`' }"   // uUnexpected token '
-p "{ `"sku`" : `"`" }"   // Unexpected token s
-p "{\"sku\":{\"tier\": \"Standard\"}}"    // SKU cannot be null.

-p is supposed to be "a JSON-formatted string containing properties". What do they mean by that?

juvchan
  • 6,113
  • 2
  • 22
  • 35
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467

2 Answers2

1

Try this if you intend to use api-version 2015-08-01

azure resource create MyGroup MyFarm "Microsoft.Web/ServerFarms" 
  -l "West US" -o "2015-08-01" 
  -p "{\"sku\":{\"tier\": \"Standard\", \"name\": \"S1\"}, \"properties\": {\"numberOfWorkers\": 1, \"workerSize\": 0}"
juvchan
  • 6,113
  • 2
  • 22
  • 35
0

This works with -apiVersion 2015-06-01 though I haven't figured out the schema change for 2015-08-01.

azure resource create MyGroup MyFarm "Microsoft.Web/ServerFarms" 
  -l "West US" -o "2015-06-01" 
  -p "{\"sku\":{\"tier\": \"Standard\"},\"numberOfWorkers\":1,\"workerSize\": \"Small\"}"
Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
  • 1
    You can reference the schema for "2015-08-01" api version at this link: https://github.com/Azure/azure-resource-manager-schemas/blob/master/schemas/2015-08-01/Microsoft.Web.json – juvchan Feb 19 '16 at 21:00