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?
Asked
Active
Viewed 74 times
0

John
- 351
- 5
- 18
-
See this answer - https://stackoverflow.com/a/49329357/4148708 – evilSnobu May 29 '18 at 16:25
-
Great, thanks. I will give it a try. – John May 29 '18 at 16:28
-
@evilSnobu : it worked, but 2 suggestions in the answer. I will use your code. – John May 30 '18 at 12:43
1 Answers
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