Closed winticloud closed 3 years ago
take out that parameter and it works. I'll update the powershell, not sure what @JamesDLD did cause i got the same error. ill take that out of the example in the repo
These are the missing lines. When doing a pull request it doesn't see it :
Hi @scautomation , another method, much more elegant actually is to get the workbookSerializedData from the json itself like :
## Variable
$AzureRmSubscriptionName = "my-subsctiption-name"
$RgName = "my-workbook-rg-name"
$workbookDisplayName = "Network Debug"
$workbookSourceId = "Azure Monitor"
$workbookType = "workbook"
$templateUri = "https://raw.githubusercontent.com/JamesDLD/AzureRm-Template/master/Create-AzWorkbookNetwork/template.json"
$workbookSerializedData = Invoke-RestMethod -Uri "https://raw.githubusercontent.com/JamesDLD/AzureRm-Template/master/Create-AzWorkbookNetwork/galleryTemplate.json"
## Connectivity
# Login first with Connect-AzAccount if not using Cloud Shell
$AzureRmContext = Get-AzSubscription -SubscriptionName $AzureRmSubscriptionName | Set-AzContext -ErrorAction Stop
Select-AzSubscription -Name $AzureRmSubscriptionName -Context $AzureRmContext -Force -ErrorAction Stop
## Action
Write-Host "Deploying : $workbookType-$workbookDisplayName in the resource group : $RgName" -ForegroundColor Cyan
New-AzResourceGroupDeployment -Name $(("$workbookType-$workbookDisplayName").replace(' ', '')) -ResourceGroupName $RgName `
-TemplateUri $TemplateUri `
-workbookDisplayName $workbookDisplayName `
-workbookType $workbookType `
-workbookSourceId $workbookSourceId `
-workbookSerializedData ($workbookSerializedData | ConvertTo-Json -Depth 20) `
-Confirm -ErrorAction Stop
Source : NSG Traffic Analytics with an Azure Monitor Workbook
When running the PS code, the following error occurs
New-AzResourceGroupDeployment : A parameter cannot be found that matches parameter name 'workbookSerializedData'. At line:6 char:3 -workbookSerializedData ($workbookSerializedData | ConvertTo-Json - ... CategoryInfo : InvalidArgument: (:) [New-AzResourceGroupDeployment], ParameterBindingException FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
In the armTemplate/template.json, the parameter named workbookSerializedData seems to be missing