0

Anyone aware of cmdlet for creating API App in powershell? I tried searching for it, but couldn't find anything. I think New-AzureRmWebApp is way to go by passing some type, has anyone idea about it?

John
  • 351
  • 5
  • 18

1 Answers1

1

As mentioned by evilSnobu in this link it worked with slight modification. So I am posting the answer if someone needs it.

# CREATE "just-an-api" API App

$ResourceLocation = "West US"
$ResourceName = "just-an-api"
$ResourceGroupName = "demo"

# If we want to create under a specific app plan, we need to pass the server farmid in format
$serverFarmId = "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.Web/serverfarms/<app_service_plan_name>;

#If nothing is passed inside $PropertiesObject, it create s default app service plan.
$PropertiesObject = @{"serverFarmId"=$serverFarmId}

New-AzureRmResource -Location $ResourceLocation `
    -PropertyObject $PropertiesObject `
    -ResourceGroupName $ResourceGroupName `
    -ResourceType Microsoft.Web/sites `
    -ResourceName "just-an-api" ` #removing $ResourceName, as either one is required.
    -Kind 'api' `
    -ApiVersion 2016-08-01 -Force
John
  • 351
  • 5
  • 18