I've created an Azure Powershell Runbook to scale UP or Down a Datawarehouse dedicated SQL Pool using the Invoke-RestMethod but is failing with the following error:
At line:31 char:11 + $Body = @ + ~ Unrecognized token in source text. At line:36 char:6 + "name" = "DW500c" + ~~~~~~ The assignment expression is not valid. The input to an assignment operator must be an object that is able to accept assignments, such as a variable or a property.
Here is the code being used
$Url = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Sql/servers/$sqlServerName/databases/$SynapseSqlPoolName?api-version=2020-08-01-preview HTTP/1.1 Content-Type: application/json; charset=UTF-8"
    $Body = @ 
        {
            location: "West Europe",
            "sku":
            {
                "name" = "DW500c"
            }
        }       
    Invoke-RestMethod -Method POST -Uri $url -Body $body -UseBasicParsing
I've tried to change the "=" with ":" but it gives the same error
I've tried with the solution below provided by Mathias but I'm getting a new error
$Body = @{
        location = "West Europe"
        sku = @{
            name = "DW500c"
        }
    }
Error:
The remote server returned an error ( 400) Bad Request
Invoke-RestMethod : {"error":{"code":"MissingApiVersionParameter","message":"The api-version query parameter (?api-version=) is required for all requests."}} At line:38 char:3 + Invoke-RestMethod -Method POST -Uri $url -Body $body -UseBasi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Latest code but getting "The specified content type is invalid"
$Url = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Sql/servers/$sqlServerName/databases/$SynapseSqlPoolName?api-version=2020-08-01-preview" 
    $ContentType = "HTTP/1.1 Content-Type:application/json;charset=UTF-8"
    $Body = @{
        location = "West Europe"
        sku = @{
            name = "DW500c"
        }
    }       
    Invoke-RestMethod -Method POST -Uri $url -ContentType $ContentType -Body $body -UseBasicParsing
The problem with the Content Type has been fixed but I'm still getting the api version error . Below is the full code
Param
(
    # This is the Resource group where Azure Synapse Analytics SQL Pool is located   
    [Parameter(Mandatory=$True)]  
    [String] $resourceGroupName
    ,
    # This is the name of the Azure SQL Server hosting the Azure Synapse Analytics SQL Pool
    [Parameter(Mandatory=$True)]  
    [String] $sqlServerName
    ,
    # This is the name of the Azure Synapse Analytics SQL Pool
    [Parameter(Mandatory=$True)]  
    [String] $SynapseSqlPoolName
    ,
    # This is the name of the Azure Synapse Analytics SQL Pool
    [Parameter(Mandatory=$True)]  
    [String] $SubscriptionId
    ,
    # This is the name of the Azure Synapse Analytics SQL Pool
    [Parameter(Mandatory=$True)]  
    [String] $Sku
)
    $ConnectionName = 'AzureRunAsConnection'
    $ServicePrincipalConnection = Get-AutomationConnection -Name $ConnectionName
    'Log in to Azure...'
    $null = Connect-AzAccount `
    -ServicePrincipal `
    -TenantId $ServicePrincipalConnection.TenantId `
    -ApplicationId $ServicePrincipalConnection.ApplicationId `
    -CertificateThumbprint $ServicePrincipalConnection.CertificateThumbprint 
    $Url = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$resourceGroupName/providers/Microsoft.Sql/servers/$sqlServerName/databases/$SynapseSqlPoolName?api-version=2020-08-01-preview" 
    $ContentType = "application/json;charset=UTF-8"
    $Body = @{
        location = "West Europe"
        sku = @{
            name = $Sku
        }
    }       
    Invoke-RestMethod -Method POST -Uri $url -ContentType $ContentType -Body $body -UseBasicParsing