I want to create an Azure Resource Group using a REST API call, but I can't seem to get the syntax right. Here's what I have:
$validateResourceGroupUri = 'https://management.azure.com/subscriptions/SUBSCRIPTION_ID/resourceGroups/' + $resourceGroupName + '/?api-version=2015-01-01'
try { $trapValidateResponse = Invoke-RestMethod -Method PUT -Headers $armHeaders -Uri $validateResourceGroupUri -Body $deploymentTemplate }
catch { throw $_ }
Where:
$deploymentTemplate = JSON deployment template (obviously)
$resourceGroupName = user-inputted RG name to be created
$armHeaders = @{ 'Authorization' = "Bearer $token"; 'Content-Type' = "Application/json" }
I have a feeling the issue resides in the -Body parameter, but I can't seem to find anything online detailing what exactly the call should consist of. I found THIS where, if you scroll down to "Create a resource group" section, it details some information, but that's unfortunately all I've been able to find. Any thoughts?
