How to import/export dashboards from a enviroment to another

Are the datasources also being copied (Just for curiosity?)

Yeah now it seems a complicated solution

In which of the 2 solutions?

The one you copy data and conf folders

Try it out :wink: and post back

Remember, you can also always backup data and conf folders into tfs. 0 line of code required

A little problem, when i do this :
$Headers = @{ Authorization = “Bearer $($Key)”}
$outputPath = “$PSScriptRoot\Output”
$outputFolderPath = “$([System.IO.Path]::Combine($outputPath,“Folder”))”;

New-Item -ItemType Directory -Force -Path $outputPath > $null;
New-Item -ItemType Directory -Force -Path $outputFolderPath > $null;
$uid = “SkFM-P57z”
#On récupère les folders
$Dashboards = Invoke-RestMethod -Uri “$($GrafanaURL)/api/dashboards/uid/$($uid)” -Method Get -Headers $Headers -ContentType ‘application/json’;
Write-Output $Dashboards

The Write-Output write this :
@{type=db; canSave=False; canEdit=False; canAdmin=False; canStar=True; canDelete=False; slug=business-finance-sage-x3; url=/d/SkFM-P57z/business-finance-sage-x3; expires=0001-01-01T00:00:00Z; created=2022-10-27T11:…
It’s not the json dashboard :frowning:
what’s wrong ?

Great but how to do this ???

Talk to your tfs admin

Aucun idé. C’est compliqué

Sorry but I do not have enough information to analyze what is failing.

Did you try the option 2?

Have you tried to open the json file created by your code, if yes, does the out-file method export all parameters of the dashboard ?

not yet but next week yes !!!

I wouldn’t post untested code.

"templating": {
            "list": [
                {
                    "current": {
                        "selected": true,
                        "text": "Prod",
                        "value": "sqlprod"
                    },
                    "hide": 0,
                    "includeAll": false,
                    "multi": false,
                    "name": "environs",

Hi there,

I have imported a dashboard from grafana v10.1 to grafana v.7.4 on diferent environment but the panels did not work correctly. WHy?

Welcome @muneeb2322000

This thread is solved so maybe you can open a new thread and explain in detail what you mean with “it does not work”