in internal/scanners/psql/rules.go [108:183]
func (a *PostgreFlexibleScanner) GetRecommendations() map[string]models.AzqrRecommendation {
return map[string]models.AzqrRecommendation{
"psqlf-001": {
RecommendationID: "psqlf-001",
ResourceType: "Microsoft.DBforPostgreSQL/flexibleServers",
Category: models.CategoryMonitoringAndAlerting,
Recommendation: "PostgreSQL should have diagnostic settings enabled",
Impact: models.ImpactLow,
Eval: func(target interface{}, scanContext *models.ScanContext) (bool, string) {
service := target.(*armpostgresqlflexibleservers.Server)
_, ok := scanContext.DiagnosticsSettings[strings.ToLower(*service.ID)]
return !ok, ""
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/howto-configure-and-access-logs",
},
"psqlf-003": {
RecommendationID: "psqlf-003",
ResourceType: "Microsoft.DBforPostgreSQL/flexibleServers",
Category: models.CategoryHighAvailability,
Recommendation: "PostgreSQL should have a SLA",
RecommendationType: models.TypeSLA,
Impact: models.ImpactHigh,
Eval: func(target interface{}, scanContext *models.ScanContext) (bool, string) {
i := target.(*armpostgresqlflexibleservers.Server)
sla := "99.9%"
if i.Properties.HighAvailability != nil && *i.Properties.HighAvailability.Mode == armpostgresqlflexibleservers.HighAvailabilityModeZoneRedundant {
if *i.Properties.HighAvailability.StandbyAvailabilityZone == *i.Properties.AvailabilityZone {
sla = "99.95%"
} else {
sla = "99.99%"
}
}
return false, sla
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-compare-single-server-flexible-server",
},
"psqlf-004": {
RecommendationID: "psqlf-004",
ResourceType: "Microsoft.DBforPostgreSQL/flexibleServers",
Category: models.CategorySecurity,
Recommendation: "PostgreSQL should have private access enabled",
Impact: models.ImpactHigh,
Eval: func(target interface{}, scanContext *models.ScanContext) (bool, string) {
i := target.(*armpostgresqlflexibleservers.Server)
pe := *i.Properties.Network.PublicNetworkAccess == armpostgresqlflexibleservers.ServerPublicNetworkAccessStateDisabled
return !pe, ""
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-networking#private-access-vnet-integration",
},
"psqlf-006": {
RecommendationID: "psqlf-006",
ResourceType: "Microsoft.DBforPostgreSQL/flexibleServers",
Category: models.CategoryGovernance,
Recommendation: "PostgreSQL Name should comply with naming conventions",
Impact: models.ImpactLow,
Eval: func(target interface{}, scanContext *models.ScanContext) (bool, string) {
c := target.(*armpostgresqlflexibleservers.Server)
caf := strings.HasPrefix(*c.Name, "psql")
return !caf, ""
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations",
},
"psqlf-007": {
RecommendationID: "psqlf-007",
ResourceType: "Microsoft.DBforPostgreSQL/flexibleServers",
Category: models.CategoryGovernance,
Recommendation: "PostgreSQL should have tags",
Impact: models.ImpactLow,
Eval: func(target interface{}, scanContext *models.ScanContext) (bool, string) {
c := target.(*armpostgresqlflexibleservers.Server)
return len(c.Tags) == 0, ""
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources?tabs=json",
},
}
}