Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
New-AzPortalDashboard
- Preview
- Module:
- Az.Portal Module
This cmdlet is part of a Preview module. Preview versions aren't recommended for use in production environments. For more information, see https://aka.ms/azps-refstatus.
create a Dashboard.
Syntax
CreateExpanded (Default)
New-AzPortalDashboard
-Name <String>
-ResourceGroupName <String>
-Location <String>
[-SubscriptionId <String>]
[-Lens <IDashboardLens[]>]
[-Metadata <Hashtable>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Create
New-AzPortalDashboard
-Name <String>
-ResourceGroupName <String>
-Resource <IDashboard>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonFilePath
New-AzPortalDashboard
-Name <String>
-ResourceGroupName <String>
-JsonFilePath <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateViaJsonString
New-AzPortalDashboard
-Name <String>
-ResourceGroupName <String>
-JsonString <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
CreateByFile
New-AzPortalDashboard
-Name <String>
-ResourceGroupName <String>
-DashboardPath <String>
[-SubscriptionId <String>]
[-DefaultProfile <PSObject>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
create a Dashboard.
Examples
Example 1: Create a dashboard using a dashboard template file
New-AzPortalDashboard -DashboardPath .\resources\dash1.json -ResourceGroupName mydash-rg -DashboardName my-dashboard03
Location Name Type
-------- ---- ----
eastasia my-dashboard03 Microsoft.Portal/dashboards
Create a new dashboard using the provided dashboard template file.
Example 2: Workaround for dashboard creation issues using Invoke-AzRestMethod
$SubscriptionId = (Get-AzContext).Subscription.Id
$ResourceGroupName = 'mydash-rg'
$DashboardName = 'my-dashboard03'
$DashboardPath = ".\resources\dash1.json"
$Location = "East US"
$ApiVersion = "2022-12-01-preview"
$Dashboard = Get-Content -Path $DashboardPath -Raw | ConvertFrom-Json
$Payload = @{
properties = $Dashboard.properties
location = $Location
} | ConvertTo-Json -Depth 10
Invoke-AzRestMethod -SubscriptionId $SubscriptionId -ResourceGroupName $ResourceGroupName -ResourceProviderName "Microsoft.Portal" -ResourceType "dashboards" -Name $DashboardName -ApiVersion $ApiVersion -Method PUT -Payload $Payload
StatusCode : 200
Content : {"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mydash-rg/providers/Microsoft.Portal/dashboards/my-dashboard03","name":"my-dashboard03","type":"Microsoft.Portal/dashboards","location":"East US","properties":{...}}
Headers : {[Content-Length, 1234], [Content-Type, application/json; charset=utf-8], [Date, Wed, 01 Jan 2025 00:00:00 GMT]}
Use this workaround when New-AzPortalDashboard succeeds but the dashboard fails to render with "Dashboard not found" error. This issue is with the underlying REST API and this method provides a reliable alternative.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | cf |
Parameter sets
-DashboardPath
The Path to an existing dashboard template. Dashboard templates may be downloaded from the portal.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-DefaultProfile
The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.
Parameter properties
| Type: | PSObject |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | AzureRMContext, AzureCredential |
Parameter sets
-JsonFilePath
Path of Json file supplied to the Create operation
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-JsonString
Json string supplied to the Create operation
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Lens
The dashboard lenses.
Parameter properties
| Type: | |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Location
The geo-location where the resource lives
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Metadata
The dashboard metadata.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Name
The name of the dashboard.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | DashboardName |
Parameter sets
-Resource
The shared dashboard resource definition.
Parameter properties
| Type: | IDashboard |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-ResourceGroupName
The name of the resource group. The name is case insensitive.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-SubscriptionId
The ID of the target subscription. The value must be an UUID.
Parameter properties
| Type: | String |
| Default value: | (Get-AzContext).Subscription.Id |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-Tag
Resource tags.
Parameter properties
| Type: | Hashtable |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Parameter properties
| Type: | SwitchParameter |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | wi |
Parameter sets
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
IDashboard
Outputs
IDashboard
Azure PowerShell
Feedback
Was this page helpful?
