Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FinOps toolkit 0.7 - Add finops-workbooks template #14233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions quickstarts/microsoft.costmanagement/finops-workbooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
description: This template deploys Azure Monitor workbooks from the FinOps toolkit that can help engineers perform key tasks defined by the FinOps Framework.
page_type: sample
products:
- azure
urlFragment: finops-workbooks
languages:
- bicep
- json
---

# FinOps workbooks template

![Azure Public Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/PublicLastTestDate.svg)
![Azure Public Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/PublicDeployment.svg)

![Azure US Gov Last Test Date](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/FairfaxLastTestDate.svg)
![Azure US Gov Last Test Result](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/FairfaxDeployment.svg)

![Best Practice Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/BestPracticeResult.svg)
![Cred Scan Check](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/CredScanResult.svg)
![Bicep Version](https://azurequickstartsservice.blob.core.windows.net/badges/quickstarts/microsoft.costmanagement/finops-workbooks/BicepVersion.svg)

[![Deploy To Azure](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.svg?sanitize=true)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Ffinops-workbooks%2Fazuredeploy.json/createUIDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Ffinops-workbooks%2FcreateUiDefinition.json)
[![Deploy To Azure US Gov](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazuregov.svg?sanitize=true)](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Ffinops-workbooks%2Fazuredeploy.json/createUIDefinitionUri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Ffinops-workbooks%2FcreateUiDefinition.json)
[![Visualize](https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.svg?sanitize=true)](http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fquickstarts%2Fmicrosoft.costmanagement%2Ffinops-workbooks%2Fazuredeploy.json)

This template deploys a set of workbooks that help you implement FinOps capabilities. FinOps workbooks are tools designed for engineers with direct access to resources to manage and optimize cloud resources.

FinOps workbooks include:

- **Optimization** - Supports workload and rate optimization, sustainability, and security, and more as defined by the Well Architected Framework.
- **Governance** - Supports policy compliance and cloud governance scenarios as defined by the Well Architected Framework.

To learn more about FinOps workbooks, the roadmap, or how to contribute , see [FinOps workbooks documentation](https://aka.ms/finops/workbooks).

<br>

## 📋 Prerequisites

Azure Monitor workbooks provide direct access to Azure resource details. To deploy workbooks, you must have the **Workbook Contributor** role. To use workbooks, you need read access to the resources being monitored. The exact permissions vary by resource and service.

If you run into any issues, see [Troubleshooting FinOps toolkit solutions](https://aka.ms/ftk/tsg).

<br>

## 📗 How to use this template

Once your workbooks are deployed, you can use them by navigating to one of the following destinations:

1. From Azure Monitor:
1. Select [**Workbooks**](https://portal.azure.com/#view/Microsoft_Azure_Monitoring/AzureMonitoringBrowseBlade/~/workbooks) in the menu.
2. Verify your subscription is selected in the **Subscription** filter.
3. Select the applicable workbook.
2. From the resource group:
1. Select the desired workbook resource.
2. Select **Workbook** in the menu.
3. From [Azure workbooks](https://portal.azure.com/#browse/microsoft.insights%2Fworkbooks):
1. Select the desired workbook.
2. Select **Workbook** in the menu.

> ℹ️ _**Pro tip:** If you navigate to the workbook resource (2 or 3 above), consider adding the workbook as a favorite using the star icon to the right of the resource name to make it easier to find in the future. Favorite resources can be opened directly from the Resources > Favorite section of the Azure portal default home page._

<br>

## 🧰 About the FinOps toolkit

FinOps workbooks are part of the [FinOps toolkit](https://aka.ms/finops/toolkit), an open source collection of FinOps solutions that help you manage and optimize your cost, usage, and carbon.

To contribute to the FinOps toolkit, [join us on GitHub](https://aka.ms/ftk).

<br>

`Tags: finops, cost, usage, carbon, optimization, policy, governance, Microsoft.Insights/workbooks`
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// See https://aka.ms/bicep/config for more information on Bicep configuration options
// Press CTRL+SPACE/CMD+SPACE at any location to see Intellisense suggestions
"analyzers": {
"core": {
"rules": {
"no-deployments-resources": {
"level": "off"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
"handler": "Microsoft.Azure.CreateUIDef",
"version": "0.1.2-preview",
"parameters": {
"config": {
"basics": {
"description": "FinOps workbooks facilitate FinOps tasks that help you build, manage, and optimize cloud resources. [Learn more](https://aka.ms/finops/workbooks)",
"location": {
"label": "Location",
"resourceTypes": ["Microsoft.Insights/workbooks"]
}
}
},
"resourceTypes": ["Microsoft.Insights/workbooks"],
"basics": [
{
"name": "displayNamePrefix",
"type": "Microsoft.Common.TextBox",
"label": "Name prefix",
"defaultValue": "FinOps",
"toolTip": "Prefix to use for each of the workbook names (e.g., 'FinOps-Optimization', 'FinOps-Governance').",
"constraints": {
"required": true,
"regex": "^.{1,220}$",
"validationMessage": "Name prefix cannot be longer than 220 characters."
},
"visible": true
}
],
"steps": [
{
"name": "workbooks",
"label": "Workbooks",
"elements": [
{
"name": "workbookSelectionIntro",
"options": { "text": "Select the FinOps workbooks you would like to include in this deployment. You can select more later." },
"type": "Microsoft.Common.TextBlock"
},
{
"name": "includeOptimization",
"label": "Optimization",
"toolTip": "Select to include the optimization workbook for workload and rate optimization as well as sustainability, security, and more.",
"type": "Microsoft.Common.CheckBox",
"defaultValue": true
},
{
"name": "includeGovernance",
"label": "Governance",
"toolTip": "Select to include the governance workbook for queries to support the Well-Architected Framework governance pillar.",
"type": "Microsoft.Common.CheckBox",
"defaultValue": true
}
]
}
],
"outputs": {
"displayNamePrefix": "[basics('displayNamePrefix')]",
"includeOptimization": "[steps('workbooks').includeOptimization]",
"includeGovernance": "[steps('workbooks').includeGovernance]",
"location": "[location()]"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.7
116 changes: 116 additions & 0 deletions quickstarts/microsoft.costmanagement/finops-workbooks/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

targetScope = 'resourceGroup'

//==============================================================================
// Parameters
//==============================================================================

@sys.description('Optional. Display name prefix to use for all workbooks. Default: "FinOps".')
param displayNamePrefix string = 'FinOps'

@sys.description('Optional. Indicates whether to deploy the optimization workbook. Default: true.')
param includeOptimization bool = true

@sys.description('Optional. Indicates whether to deploy the governance workbook. Default: true.')
param includeGovernance bool = true

@sys.description('Optional. Location of the resources. Default: Same as deployment. See https://aka.ms/azureregions.')
param location string = resourceGroup().location

@sys.description('Optional. Tags for all resources.')
param tags object = {}

@description('Optional. Tags to apply to resources based on their resource type. Resource type specific tags will be merged with tags for all resources.')
param tagsByResource object = {}

@sys.description('Optional. Enable telemetry to track anonymous module usage trends, monitor for bugs, and improve future releases.')
param enableDefaultTelemetry bool = true

//------------------------------------------------------------------------------
// Variables
//------------------------------------------------------------------------------

// The last segment of the telemetryId is used to identify this module
var telemetryId = '00f120b5-2007-6120-0000-a7730126b006'
var finOpsToolkitVersion = loadTextContent('ftkver.txt')

// Add tags to all resources
var resourceTags = union(
tags,
tagsByResource[?'Microsoft.Insights/workbooks'] ?? {},
{
'ftk-version': finOpsToolkitVersion
'ftk-tool': 'FinOps workbooks'
}
)

//==============================================================================
// Resources
//==============================================================================

//------------------------------------------------------------------------------
// Telemetry
// Used to anonymously count the number of times the template has been deployed
// and to track and fix deployment bugs to ensure the highest quality.
// No information about you or your cost data is collected.
//------------------------------------------------------------------------------

resource defaultTelemetry 'Microsoft.Resources/deployments@2022-09-01' = if (enableDefaultTelemetry) {
name: 'pid-${telemetryId}-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
metadata: {
_generator: {
name: 'FinOps toolkit'
version: finOpsToolkitVersion
}
}
resources: []
}
}
}

//------------------------------------------------------------------------------
// Workbooks
//------------------------------------------------------------------------------

module optimization 'workbooks/optimization/main.bicep' = if (includeOptimization) {
name: '${displayNamePrefix}-Optimization'
params: {
displayName: '${displayNamePrefix} - Optimization'
location: location
tags: resourceTags
enableDefaultTelemetry: false
}
}

module governance 'workbooks/governance/main.bicep' = if (includeGovernance) {
name: '${displayNamePrefix}-Governance'
params: {
displayName: '${displayNamePrefix} - Governance'
location: location
tags: resourceTags
enableDefaultTelemetry: false
}
}

//==============================================================================
// Outputs
//==============================================================================

@sys.description('Optimization workbook resource ID.')
output optimizationId string = optimization.outputs.workbookId

@sys.description('Optimization workbook Azure portal link.')
output optimizationUrl string = optimization.outputs.workbookUrl

@sys.description('Governance workbook resource ID.')
output governanceId string = governance.outputs.workbookId

@sys.description('Governance workbook Azure portal link.')
output governanceUrl string = governance.outputs.workbookUrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://aka.ms/azure-quickstart-templates-metadata-schema#",
"type": "QuickStart",
"itemDisplayName": "FinOps workbooks",
"summary": "Deploy a set of workbooks that help you implement FinOps capabilities",
"description": "This template deploys Azure Monitor workbooks from the FinOps toolkit that can help engineers perform key tasks defined by the FinOps Framework.",
"githubUsername": "flanakin",
"dateUpdated": "2024-08-25"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.7
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

targetScope = 'resourceGroup'

//==============================================================================
// Parameters
//==============================================================================

@sys.description('Optional. Display name for the workbook used in the Gallery. Must be unique in the resource group.')
param displayName string = 'Governance'

@sys.description('Optional. Location of the resources. Default: Same as deployment. See https://aka.ms/azureregions.')
param location string = resourceGroup().location

@sys.description('Optional. Workbook description.')
param description string = 'Reports to help you optimize your cost.'

@sys.description('Optional. Tags for all resources.')
param tags object = {}

@sys.description('Optional. Enable telemetry to track anonymous module usage trends, monitor for bugs, and improve future releases.')
param enableDefaultTelemetry bool = true

//------------------------------------------------------------------------------
// Variables
//------------------------------------------------------------------------------

var version = ''
var workbookJson = string(loadJsonContent('workbook.json'))

// The last segment of the telemetryId is used to identify this module
var workbookId = '907'
var telemetryId = '00f120b5-2007-6120-0000-${workbookId}30126b006'
var finOpsToolkitVersion = loadTextContent('ftkver.txt')

// Add tags to all resources
var resourceTags = contains(tags, 'ftk-tool') ? tags : union(tags, {
'ftk-version': finOpsToolkitVersion
'ftk-tool': '${displayName} workbook'
})

//==============================================================================
// Resources
//==============================================================================

//------------------------------------------------------------------------------
// Telemetry
// Used to anonymously count the number of times the template has been deployed
// and to track and fix deployment bugs to ensure the highest quality.
// No information about you or your cost data is collected.
//------------------------------------------------------------------------------

resource defaultTelemetry 'Microsoft.Resources/deployments@2022-09-01' = if (enableDefaultTelemetry) {
name: 'pid-${telemetryId}-${uniqueString(deployment().name, location)}'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
metadata: {
_generator: {
name: 'FinOps toolkit'
version: finOpsToolkitVersion
}
}
resources: []
}
}
}

//------------------------------------------------------------------------------
// Workbook
//------------------------------------------------------------------------------

resource workbook 'Microsoft.Insights/workbooks@2022-04-01' = {
name: guid(resourceGroup().id, 'Microsoft.Insights/workbooks', displayName)
location: location
tags: resourceTags
kind: 'shared'
properties: {
category: 'workbook'
description: description
displayName: displayName
serializedData: workbookJson
sourceId: 'Azure Monitor'
version: version
}
}

//==============================================================================
// Outputs
//==============================================================================

@sys.description('The resource ID of the workbook.')
output workbookId string = workbook.id

@sys.description('Link to the workbook in the Azure portal.')
output workbookUrl string = '${environment().portal}/#view/AppInsightsExtension/UsageNotebookBlade/ComponentId/Azure%20Monitor/ConfigurationId/${uriComponent(workbook.id)}/Type/${workbook.properties.category}/WorkbookTemplateName/${uriComponent(workbook.properties.displayName)}'
Loading
Loading