-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(new): Added Azure.Grafana.Version (#2883)
* feat(new): Added Azure.Grafana.Version * fix: Removed file * Bump docs --------- Co-authored-by: Bernie White <[email protected]>
- Loading branch information
1 parent
fb7cdd1
commit bbe08c4
Showing
5 changed files
with
278 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
severity: Important | ||
pillar: Reliability | ||
category: RE:04 Target metrics | ||
resource: Azure Managed Grafana | ||
online version: https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Grafana.Version/ | ||
--- | ||
|
||
# Upgrade Grafana version | ||
|
||
## SYNOPSIS | ||
|
||
Grafana workspaces should be on Grafana version 10. | ||
|
||
## DESCRIPTION | ||
|
||
Support for Grafana version 9 within Azure Managed Grafana is deprecated and will retire on 31 August 2024. | ||
To avoid support disruptions, upgrade to Grafana version 10. | ||
|
||
## RECOMMENDATION | ||
|
||
Upgrade to Grafana version 10 for Azure Managed Grafana workspaces to avoid support disruptions. | ||
|
||
## EXAMPLES | ||
|
||
### Configure with Azure template | ||
|
||
To deploy Azure Managed Grafana workspaces that pass this rule: | ||
|
||
- Set the `properties.grafanaMajorVersion` property to `10`. | ||
|
||
For example: | ||
|
||
```json | ||
{ | ||
"type": "Microsoft.Dashboard/grafana", | ||
"apiVersion": "2023-09-01", | ||
"name": "[parameters('name')]", | ||
"location": "[parameters('location')]", | ||
"sku": { | ||
"name": "Standard" | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned" | ||
}, | ||
"properties": { | ||
"grafanaMajorVersion": "10" | ||
} | ||
} | ||
``` | ||
|
||
### Configure with Bicep | ||
|
||
To deploy Azure Managed Grafana workspaces that pass this rule: | ||
|
||
- Set the `properties.grafanaMajorVersion` property to `10`. | ||
|
||
For example: | ||
|
||
```bicep | ||
resource grafana 'Microsoft.Dashboard/grafana@2023-09-01' = { | ||
name: name | ||
location: location | ||
sku: { | ||
name: 'Standard' | ||
} | ||
identity: { | ||
type: 'SystemAssigned' | ||
} | ||
properties: { | ||
grafanaMajorVersion: '10' | ||
} | ||
} | ||
``` | ||
|
||
### Configure with Azure CLI | ||
|
||
```bash | ||
az grafana update --name <azure-managed-grafana-workspace> --major-version 10 | ||
``` | ||
|
||
## LINKS | ||
|
||
- [RE:04 Target metrics](https://learn.microsoft.com/azure/well-architected/reliability/metrics) | ||
- [Update to using Grafana version 10 for Azure Managed Grafana](https://azure.microsoft.com/updates/action-recommended-update-to-using-grafana-version-10-for-azure-managed-grafana) | ||
- [Upgrade to Grafana 10](https://learn.microsoft.com/azure/managed-grafana/how-to-upgrade-grafana-10) | ||
- [Azure resource deployment](https://learn.microsoft.com/azure/templates/microsoft.dashboard/grafana) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# | ||
# Validation rules for Azure Managed Grafana | ||
# | ||
|
||
#region Rules | ||
|
||
--- | ||
# Synopsis: Grafana workspaces should be on Grafana version 10. | ||
apiVersion: github.com/microsoft/PSRule/v1 | ||
kind: Rule | ||
metadata: | ||
name: Azure.Grafana.Version | ||
ref: AZR-000424 | ||
tags: | ||
release: GA | ||
ruleSet: 2024_06 | ||
Azure.WAF/pillar: Reliability | ||
spec: | ||
type: | ||
- Microsoft.Dashboard/grafana | ||
condition: | ||
field: properties.grafanaMajorVersion | ||
greaterOrEquals: 10 | ||
convert: true | ||
|
||
#endregion Rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# | ||
# Unit tests for Azure Managed Grafana rules | ||
# | ||
|
||
[CmdletBinding()] | ||
param () | ||
|
||
BeforeAll { | ||
# Setup error handling | ||
$ErrorActionPreference = 'Stop'; | ||
Set-StrictMode -Version latest; | ||
|
||
if ($Env:SYSTEM_DEBUG -eq 'true') { | ||
$VerbosePreference = 'Continue'; | ||
} | ||
|
||
# Setup tests paths | ||
$rootPath = $PWD; | ||
Import-Module (Join-Path -Path $rootPath -ChildPath out/modules/PSRule.Rules.Azure) -Force; | ||
$here = (Resolve-Path $PSScriptRoot).Path; | ||
} | ||
|
||
Describe 'Azure.Grafana' -Tag 'Grafana' { | ||
Context 'Conditions' { | ||
BeforeAll { | ||
$invokeParams = @{ | ||
Baseline = 'Azure.All' | ||
Module = 'PSRule.Rules.Azure' | ||
WarningAction = 'Ignore' | ||
ErrorAction = 'Stop' | ||
} | ||
$dataPath = Join-Path -Path $here -ChildPath 'Resources.Grafana.json'; | ||
$result = Invoke-PSRule @invokeParams -InputPath $dataPath; | ||
} | ||
|
||
It 'Azure.Grafana.Version' { | ||
$filteredResult = $result | Where-Object { $_.RuleName -eq 'Azure.Grafana.Version' }; | ||
|
||
# Fail | ||
$ruleResult = @($filteredResult | Where-Object { $_.Outcome -eq 'Fail' }); | ||
$ruleResult.Length | Should -Be 1; | ||
$ruleResult.TargetName | Should -Be 'grafana-a'; | ||
|
||
$ruleResult[0].Reason | Should -Be "Path properties.grafanaMajorVersion: The value '9' is not >= 10."; | ||
|
||
# Pass | ||
$ruleResult = @($filteredResult | Where-Object { $_.Outcome -eq 'Pass' }); | ||
$ruleResult.Length | Should -Be 1; | ||
$ruleResult.TargetName | Should -Be 'grafana-b'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
[ | ||
{ | ||
"type": "Microsoft.Dashboard/grafana", | ||
"apiVersion": "2023-09-01", | ||
"ResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.Dashboard/grafana/grafana-a", | ||
"name": "grafana-a", | ||
"location": "westus", | ||
"tags": { | ||
"application": "grafana" | ||
}, | ||
"sku": { | ||
"name": "Standard" | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned" | ||
}, | ||
"properties": { | ||
"apiKey": "string", | ||
"autoGeneratedDomainNameLabelScope": "TenantReuse", | ||
"deterministicOutboundIP": "string", | ||
"enterpriseConfigurations": { | ||
"marketplaceAutoRenew": "string", | ||
"marketplacePlanId": "string" | ||
}, | ||
"grafanaConfigurations": { | ||
"smtp": { | ||
"enabled": "bool", | ||
"fromAddress": "string", | ||
"fromName": "string", | ||
"host": "string", | ||
"password": "string", | ||
"skipVerify": "bool", | ||
"startTLSPolicy": "string", | ||
"user": "string" | ||
} | ||
}, | ||
"grafanaIntegrations": { | ||
"azureMonitorWorkspaceIntegrations": [ | ||
{ | ||
"azureMonitorWorkspaceResourceId": "00000000-0000-0000-0000-000000000000" | ||
} | ||
] | ||
}, | ||
"grafanaMajorVersion": "9", | ||
"grafanaPlugins": { | ||
"{customized property}": {} | ||
}, | ||
"publicNetworkAccess": "Enabled", | ||
"zoneRedundancy": null | ||
} | ||
}, | ||
{ | ||
"type": "Microsoft.Dashboard/grafana", | ||
"apiVersion": "2023-09-01", | ||
"ResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.Dashboard/grafana/grafana-b", | ||
"name": "grafana-b", | ||
"location": "westeurope", | ||
"tags": { | ||
"application": "grafana" | ||
}, | ||
"sku": { | ||
"name": "Standard" | ||
}, | ||
"identity": { | ||
"type": "SystemAssigned" | ||
}, | ||
"properties": { | ||
"apiKey": "string", | ||
"autoGeneratedDomainNameLabelScope": "TenantReuse", | ||
"deterministicOutboundIP": "string", | ||
"enterpriseConfigurations": { | ||
"marketplaceAutoRenew": "string", | ||
"marketplacePlanId": "string" | ||
}, | ||
"grafanaConfigurations": { | ||
"smtp": { | ||
"enabled": "bool", | ||
"fromAddress": "string", | ||
"fromName": "string", | ||
"host": "string", | ||
"password": "string", | ||
"skipVerify": "bool", | ||
"startTLSPolicy": "string", | ||
"user": "string" | ||
} | ||
}, | ||
"grafanaIntegrations": { | ||
"azureMonitorWorkspaceIntegrations": [ | ||
{ | ||
"azureMonitorWorkspaceResourceId": "00000000-0000-0000-0000-000000000000" | ||
} | ||
] | ||
}, | ||
"grafanaMajorVersion": "10", | ||
"grafanaPlugins": { | ||
"{customized property}": {} | ||
}, | ||
"publicNetworkAccess": "Enabled", | ||
"zoneRedundancy": null | ||
} | ||
} | ||
] |