Public/New-SimpleArmResource.ps1

function New-SimpleArmResource {
    [CmdletBinding()]
    param (
        [Parameter()][string]$ResourceName,
        [Parameter()][hashtable]$Param = @{},
        [Parameter()][string]$ResourceGroup,
        [Parameter()][string]$WorkingDir,
        [Parameter()][string]$Location,
        [Parameter()][string]$Environment,
        [Parameter()][string]$Query = $null        
    )
    if ($Param) {
        $allParams = Get-HashTableAsParamString -Parameters $Param
      }
    if($query){
        $queryType = "--query $query"
    }
    else{
        $queryType = "--query properties.provisioningState"
    }
    Write-Host $Param
    Write-Host $allParams
    $resourceGroupEnvironment = "$resourceGroup"
    Write-Host $resourceGroupEnvironment
    $resourceDir = "$workingDir"
    $stopWatch = [System.Diagnostics.Stopwatch]::StartNew()
    $deploymentName = Get-DeploymentName -ResourceName $resourceName

    $result = Invoke-SimpleArmExecute -arguments "/c `"az deployment group create --no-prompt --name $deploymentName --resource-group $resourceGroupEnvironment --template-file $resourceDir\$resourceName.json --parameters $resourceDir\$resourceName.parameters.$Environment.json $allParams $queryType`""


    $stopWatch.stop()
    Write-Information "Deployment complete - Tried to create ressource $resourceName in environment $environment - Operation took $($stopWatch.Elapsed.TotalSeconds) sec - Result $result.StdOut"

}