Skip to content

Commit

Permalink
Fixed ISF URL and added support for AOE release
Browse files Browse the repository at this point in the history
  • Loading branch information
Helder Pinto committed May 10, 2024
1 parent b8262e3 commit 8fb4a17
Show file tree
Hide file tree
Showing 66 changed files with 22,987 additions and 64 deletions.
24 changes: 12 additions & 12 deletions docs/deploy/finops-hub-0.2.1-rc.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "6371350577264419703"
"version": "0.25.53.49325",
"templateHash": "13980213354947249584"
}
},
"parameters": {
Expand Down Expand Up @@ -91,8 +91,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "2610829918662778812"
"version": "0.25.53.49325",
"templateHash": "3688631684062478281"
}
},
"parameters": {
Expand Down Expand Up @@ -162,7 +162,7 @@
"dataFactorySuffix": "[format('-{0}', variables('uniqueSuffix'))]",
"dataFactoryName": "[replace(format('{0}{1}', take(variables('dataFactoryPrefix'), sub(63, length(variables('dataFactorySuffix')))), variables('dataFactorySuffix')), '--', '-')]",
"telemetryId": "00f120b5-2007-6120-0000-40b000000000",
"finOpsToolkitVersion": "placeholder"
"finOpsToolkitVersion": "0.2.1-rc.2"
},
"resources": [
{
Expand Down Expand Up @@ -234,8 +234,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "9609675916139055971"
"version": "0.25.53.49325",
"templateHash": "3183312799881178788"
}
},
"parameters": {
Expand Down Expand Up @@ -291,7 +291,7 @@
}
},
"variables": {
"$fxv#0": "placeholder",
"$fxv#0": "0.2.1-rc.2",
"$fxv#1": "# Copyright (c) Microsoft Corporation.\r\n# Licensed under the MIT License.\r\n\r\nWrite-Output \"Updating settings.json file...\"\r\nWrite-Output \" Storage account: $env:storageAccountName\"\r\nWrite-Output \" Container: $env:containerName\"\r\n\r\n$validateScopes = { $_.Length -gt 45 }\r\n\r\n# Initialize variables\r\n$fileName = 'settings.json'\r\n$filePath = Join-Path -Path . -ChildPath $fileName\r\n$newScopes = $env:exportScopes.Split('|') | Where-Object $validateScopes | ForEach-Object { @{ scope = $_ } }\r\n\r\n# Get storage context\r\n$storageContext = @{\r\n Context = New-AzStorageContext -StorageAccountName $env:storageAccountName -UseConnectedAccount\r\n Container = $env:containerName\r\n}\r\n\r\n# Download existing settings, if they exist\r\n$blob = Get-AzStorageBlobContent @storageContext -Blob $fileName -Destination $filePath -Force\r\nif ($blob) {\r\n Write-Output \"Existing settings.json file found. Updating...\"\r\n $text = Get-Content $filePath -Raw\r\n Write-Output \"---------\"\r\n Write-Output $text\r\n Write-Output \"---------\"\r\n $json = $text | ConvertFrom-Json\r\n\r\n # Rename exportScopes to scopes + convert to object array\r\n if ($json.exportScopes) {\r\n Write-Output \" Updating exportScopes...\"\r\n if ($json.exportScopes[0] -is [string]) {\r\n Write-Output \" Converting string array to object array...\"\r\n $json.exportScopes = $json.exportScopes | Where-Object $validateScopes | ForEach-Object { @{ scope = $_ } }\r\n if (-not ($json.exportScopes -is [array])) {\r\n Write-Output \" Converting single object to object array...\"\r\n $json.exportScopes = @($json.exportScopes)\r\n }\r\n }\r\n\r\n Write-Output \" Renaming to 'scopes'...\"\r\n $json | Add-Member -MemberType NoteProperty -Name scopes -Value $json.exportScopes\r\n $json.PSObject.Properties.Remove('exportScopes')\r\n }\r\n}\r\n\r\n# Set default if not found\r\nif (!$json) {\r\n Write-Output \"No existing settings.json file found. Creating new file...\"\r\n $json = [ordered]@{\r\n '$schema' = 'https://aka.ms/finops/hubs/settings-schema'\r\n type = 'HubInstance'\r\n version = ''\r\n learnMore = 'https://aka.ms/finops/hubs'\r\n scopes = @()\r\n }\r\n}\r\n\r\n# Updating settings\r\nWrite-Output \"Updating version to $env:ftkVersion...\"\r\n$json.version = $env:ftkVersion\r\nif ($newScopes) {\r\n Write-Output \"Merging $($newScopes.Count) scopes...\"\r\n $json.scopes = Compare-Object -ReferenceObject $json.scopes -DifferenceObject $newScopes -Property scope -PassThru -IncludeEqual\r\n\r\n # Remove the SideIndicator property from the Compare-Object output\r\n $json.scopes | ForEach-Object { $_.PSObject.Properties.Remove('SideIndicator') } | ConvertTo-Json\r\n\r\n if (-not ($json.scopes -is [array])) {\r\n $json.scopes = @($json.scopes)\r\n }\r\n Write-Output \"$($json.scopes.Count) scopes found.\"\r\n}\r\n$text = $json | ConvertTo-Json\r\nWrite-Output \"---------\"\r\nWrite-Output $text\r\nWrite-Output \"---------\"\r\n$text | Out-File $filePath\r\n\r\n# Upload new/updated settings\r\nWrite-Output \"Uploading settings.json file...\"\r\nSet-AzStorageBlobContent @storageContext -File $filePath -Force\r\n",
"safeHubName": "[replace(replace(toLower(parameters('hubName')), '-', ''), '_', '')]",
"storageAccountSuffix": "[parameters('uniqueSuffix')]",
Expand Down Expand Up @@ -515,8 +515,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "5738194981634133446"
"version": "0.25.53.49325",
"templateHash": "5687422994519942055"
}
},
"parameters": {
Expand Down Expand Up @@ -1829,8 +1829,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "10770478197596540923"
"version": "0.25.53.49325",
"templateHash": "8584269155107147116"
}
},
"parameters": {
Expand Down
24 changes: 12 additions & 12 deletions docs/deploy/finops-hub-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "6371350577264419703"
"version": "0.25.53.49325",
"templateHash": "13980213354947249584"
}
},
"parameters": {
Expand Down Expand Up @@ -91,8 +91,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "2610829918662778812"
"version": "0.25.53.49325",
"templateHash": "3688631684062478281"
}
},
"parameters": {
Expand Down Expand Up @@ -162,7 +162,7 @@
"dataFactorySuffix": "[format('-{0}', variables('uniqueSuffix'))]",
"dataFactoryName": "[replace(format('{0}{1}', take(variables('dataFactoryPrefix'), sub(63, length(variables('dataFactorySuffix')))), variables('dataFactorySuffix')), '--', '-')]",
"telemetryId": "00f120b5-2007-6120-0000-40b000000000",
"finOpsToolkitVersion": "placeholder"
"finOpsToolkitVersion": "0.2.1-rc.2"
},
"resources": [
{
Expand Down Expand Up @@ -234,8 +234,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "9609675916139055971"
"version": "0.25.53.49325",
"templateHash": "3183312799881178788"
}
},
"parameters": {
Expand Down Expand Up @@ -291,7 +291,7 @@
}
},
"variables": {
"$fxv#0": "placeholder",
"$fxv#0": "0.2.1-rc.2",
"$fxv#1": "# Copyright (c) Microsoft Corporation.\r\n# Licensed under the MIT License.\r\n\r\nWrite-Output \"Updating settings.json file...\"\r\nWrite-Output \" Storage account: $env:storageAccountName\"\r\nWrite-Output \" Container: $env:containerName\"\r\n\r\n$validateScopes = { $_.Length -gt 45 }\r\n\r\n# Initialize variables\r\n$fileName = 'settings.json'\r\n$filePath = Join-Path -Path . -ChildPath $fileName\r\n$newScopes = $env:exportScopes.Split('|') | Where-Object $validateScopes | ForEach-Object { @{ scope = $_ } }\r\n\r\n# Get storage context\r\n$storageContext = @{\r\n Context = New-AzStorageContext -StorageAccountName $env:storageAccountName -UseConnectedAccount\r\n Container = $env:containerName\r\n}\r\n\r\n# Download existing settings, if they exist\r\n$blob = Get-AzStorageBlobContent @storageContext -Blob $fileName -Destination $filePath -Force\r\nif ($blob) {\r\n Write-Output \"Existing settings.json file found. Updating...\"\r\n $text = Get-Content $filePath -Raw\r\n Write-Output \"---------\"\r\n Write-Output $text\r\n Write-Output \"---------\"\r\n $json = $text | ConvertFrom-Json\r\n\r\n # Rename exportScopes to scopes + convert to object array\r\n if ($json.exportScopes) {\r\n Write-Output \" Updating exportScopes...\"\r\n if ($json.exportScopes[0] -is [string]) {\r\n Write-Output \" Converting string array to object array...\"\r\n $json.exportScopes = $json.exportScopes | Where-Object $validateScopes | ForEach-Object { @{ scope = $_ } }\r\n if (-not ($json.exportScopes -is [array])) {\r\n Write-Output \" Converting single object to object array...\"\r\n $json.exportScopes = @($json.exportScopes)\r\n }\r\n }\r\n\r\n Write-Output \" Renaming to 'scopes'...\"\r\n $json | Add-Member -MemberType NoteProperty -Name scopes -Value $json.exportScopes\r\n $json.PSObject.Properties.Remove('exportScopes')\r\n }\r\n}\r\n\r\n# Set default if not found\r\nif (!$json) {\r\n Write-Output \"No existing settings.json file found. Creating new file...\"\r\n $json = [ordered]@{\r\n '$schema' = 'https://aka.ms/finops/hubs/settings-schema'\r\n type = 'HubInstance'\r\n version = ''\r\n learnMore = 'https://aka.ms/finops/hubs'\r\n scopes = @()\r\n }\r\n}\r\n\r\n# Updating settings\r\nWrite-Output \"Updating version to $env:ftkVersion...\"\r\n$json.version = $env:ftkVersion\r\nif ($newScopes) {\r\n Write-Output \"Merging $($newScopes.Count) scopes...\"\r\n $json.scopes = Compare-Object -ReferenceObject $json.scopes -DifferenceObject $newScopes -Property scope -PassThru -IncludeEqual\r\n\r\n # Remove the SideIndicator property from the Compare-Object output\r\n $json.scopes | ForEach-Object { $_.PSObject.Properties.Remove('SideIndicator') } | ConvertTo-Json\r\n\r\n if (-not ($json.scopes -is [array])) {\r\n $json.scopes = @($json.scopes)\r\n }\r\n Write-Output \"$($json.scopes.Count) scopes found.\"\r\n}\r\n$text = $json | ConvertTo-Json\r\nWrite-Output \"---------\"\r\nWrite-Output $text\r\nWrite-Output \"---------\"\r\n$text | Out-File $filePath\r\n\r\n# Upload new/updated settings\r\nWrite-Output \"Uploading settings.json file...\"\r\nSet-AzStorageBlobContent @storageContext -File $filePath -Force\r\n",
"safeHubName": "[replace(replace(toLower(parameters('hubName')), '-', ''), '_', '')]",
"storageAccountSuffix": "[parameters('uniqueSuffix')]",
Expand Down Expand Up @@ -515,8 +515,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "5738194981634133446"
"version": "0.25.53.49325",
"templateHash": "5687422994519942055"
}
},
"parameters": {
Expand Down Expand Up @@ -1829,8 +1829,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "10770478197596540923"
"version": "0.25.53.49325",
"templateHash": "8584269155107147116"
}
},
"parameters": {
Expand Down
6 changes: 3 additions & 3 deletions docs/deploy/governance-workbook-0.2.1-rc.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "12278846045479855901"
"version": "0.25.53.49325",
"templateHash": "11237752380577820438"
}
},
"parameters": {
Expand Down Expand Up @@ -8035,7 +8035,7 @@
"workbookJson": "[string(variables('$fxv#0'))]",
"workbookId": "907",
"telemetryId": "[format('00f120b5-2007-6120-0000-{0}30126b006', variables('workbookId'))]",
"finOpsToolkitVersion": "placeholder"
"finOpsToolkitVersion": "0.2.1-rc.2"
},
"resources": [
{
Expand Down
6 changes: 3 additions & 3 deletions docs/deploy/governance-workbook-latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.24.24.22086",
"templateHash": "12278846045479855901"
"version": "0.25.53.49325",
"templateHash": "11237752380577820438"
}
},
"parameters": {
Expand Down Expand Up @@ -8035,7 +8035,7 @@
"workbookJson": "[string(variables('$fxv#0'))]",
"workbookId": "907",
"telemetryId": "[format('00f120b5-2007-6120-0000-{0}30126b006', variables('workbookId'))]",
"finOpsToolkitVersion": "placeholder"
"finOpsToolkitVersion": "0.2.1-rc.2"
},
"resources": [
{
Expand Down
80 changes: 80 additions & 0 deletions docs/deploy/optimization-engine/azuredeploy-0.2.1-rc.2.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
targetScope = 'subscription'
param rgName string
param readerRoleAssignmentGuid string = guid(subscription().subscriptionId, rgName)
param contributorRoleAssignmentGuid string = guid(rgName)
param projectLocation string

@description('The base URI where artifacts required by this template are located')
param templateLocation string

param storageAccountName string
param automationAccountName string
param sqlServerName string
param sqlDatabaseName string = 'azureoptimization'
param logAnalyticsReuse bool
param logAnalyticsWorkspaceName string
param logAnalyticsWorkspaceRG string
param logAnalyticsRetentionDays int = 120
param sqlBackupRetentionDays int = 7
param sqlAdminLogin string

@secure()
param sqlAdminPassword string
param cloudEnvironment string = 'AzureCloud'
param authenticationOption string = 'ManagedIdentity'

@description('Base time for all automation runbook schedules.')
param baseTime string = utcNow('u')
param resourceTags object

param roleReader string = '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/acdd72a7-3385-48ef-bd42-f606fba81ae7'

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

resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: rgName
location: projectLocation
tags: resourceTags
dependsOn: []
}

module resourcesDeployment './azuredeploy-nested.bicep' = {
name: 'resourcesDeployment'
scope: resourceGroup(rgName)
params: {
projectLocation: projectLocation
templateLocation: templateLocation
storageAccountName: storageAccountName
automationAccountName: automationAccountName
sqlServerName: sqlServerName
sqlDatabaseName: sqlDatabaseName
logAnalyticsReuse: logAnalyticsReuse
logAnalyticsWorkspaceName: logAnalyticsWorkspaceName
logAnalyticsWorkspaceRG: logAnalyticsWorkspaceRG
logAnalyticsRetentionDays: logAnalyticsRetentionDays
sqlBackupRetentionDays: sqlBackupRetentionDays
sqlAdminLogin: sqlAdminLogin
sqlAdminPassword: sqlAdminPassword
cloudEnvironment: cloudEnvironment
authenticationOption: authenticationOption
baseTime: baseTime
contributorRoleAssignmentGuid: contributorRoleAssignmentGuid
resourceTags: resourceTags
enableDefaultTelemetry: enableDefaultTelemetry
}
dependsOn: [
rg
]
}

resource readerRoleAssignmentGuid_resource 'Microsoft.Authorization/roleAssignments@2018-09-01-preview' = {
name: readerRoleAssignmentGuid
properties: {
roleDefinitionId: roleReader
principalId: resourcesDeployment.outputs.automationPrincipalId
principalType: 'ServicePrincipal'
}
}

output automationPrincipalId string = resourcesDeployment.outputs.automationPrincipalId
Loading

0 comments on commit 8fb4a17

Please sign in to comment.