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

fix: remove parameter composing logic from avm/res/operations-management/solution #3671

Merged
merged 8 commits into from
Oct 30, 2024
Merged
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
156 changes: 120 additions & 36 deletions avm/res/operations-management/solution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ The following section provides usage examples for the module, which were used to
- [Using only defaults](#example-1-using-only-defaults)
- [Microsoft solution](#example-2-microsoft-solution)
- [Non-Microsoft solution](#example-3-non-microsoft-solution)
- [WAF-aligned](#example-4-waf-aligned)
- [SQLAuditing solution](#example-4-sqlauditing-solution)
- [WAF-aligned](#example-5-waf-aligned)

### Example 1: _Using only defaults_

Expand All @@ -44,7 +45,8 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
params: {
// Required parameters
logAnalyticsWorkspaceName: '<logAnalyticsWorkspaceName>'
name: 'Updates'
name: '<name>'
product: 'OMSGallery/Updates'
// Non-required parameters
location: '<location>'
}
Expand All @@ -68,7 +70,10 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
"value": "<logAnalyticsWorkspaceName>"
},
"name": {
"value": "Updates"
"value": "<name>"
},
"product": {
"value": "OMSGallery/Updates"
},
// Non-required parameters
"location": {
Expand All @@ -90,7 +95,8 @@ using 'br/public:avm/res/operations-management/solution:<version>'

// Required parameters
param logAnalyticsWorkspaceName = '<logAnalyticsWorkspaceName>'
param name = 'Updates'
param name = '<name>'
param product = 'OMSGallery/Updates'
// Non-required parameters
param location = '<location>'
```
Expand All @@ -113,10 +119,10 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
params: {
// Required parameters
logAnalyticsWorkspaceName: '<logAnalyticsWorkspaceName>'
name: 'AzureAutomation'
name: '<name>'
product: 'OMSGallery/AzureAutomation'
// Non-required parameters
location: '<location>'
product: 'OMSGallery'
publisher: 'Microsoft'
}
}
Expand All @@ -139,15 +145,15 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
"value": "<logAnalyticsWorkspaceName>"
},
"name": {
"value": "AzureAutomation"
"value": "<name>"
},
"product": {
"value": "OMSGallery/AzureAutomation"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"product": {
"value": "OMSGallery"
},
"publisher": {
"value": "Microsoft"
}
Expand All @@ -167,10 +173,10 @@ using 'br/public:avm/res/operations-management/solution:<version>'

// Required parameters
param logAnalyticsWorkspaceName = '<logAnalyticsWorkspaceName>'
param name = 'AzureAutomation'
param name = '<name>'
param product = 'OMSGallery/AzureAutomation'
// Non-required parameters
param location = '<location>'
param product = 'OMSGallery'
param publisher = 'Microsoft'
```

Expand All @@ -193,9 +199,9 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
// Required parameters
logAnalyticsWorkspaceName: '<logAnalyticsWorkspaceName>'
name: 'omsnonms001'
product: 'nonmsTestSolutionProduct'
// Non-required parameters
location: '<location>'
product: 'nonmsTestSolutionProduct'
publisher: 'nonmsTestSolutionPublisher'
}
}
Expand All @@ -220,13 +226,13 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
"name": {
"value": "omsnonms001"
},
"product": {
"value": "nonmsTestSolutionProduct"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"product": {
"value": "nonmsTestSolutionProduct"
},
"publisher": {
"value": "nonmsTestSolutionPublisher"
}
Expand All @@ -247,18 +253,18 @@ using 'br/public:avm/res/operations-management/solution:<version>'
// Required parameters
param logAnalyticsWorkspaceName = '<logAnalyticsWorkspaceName>'
param name = 'omsnonms001'
param product = 'nonmsTestSolutionProduct'
// Non-required parameters
param location = '<location>'
param product = 'nonmsTestSolutionProduct'
param publisher = 'nonmsTestSolutionPublisher'
```

</details>
<p>

### Example 4: _WAF-aligned_
### Example 4: _SQLAuditing solution_

This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework.
This instance deploys the module with the SQLAuditing solution. This solution is authored by Microsoft, but uses a non-standard value for the `product` parameter.


<details>
Expand All @@ -271,10 +277,10 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
params: {
// Required parameters
logAnalyticsWorkspaceName: '<logAnalyticsWorkspaceName>'
name: 'AzureAutomation'
name: '<name>'
product: 'SQLAuditing'
// Non-required parameters
location: '<location>'
product: 'OMSGallery'
publisher: 'Microsoft'
}
}
Expand All @@ -297,14 +303,93 @@ module solution 'br/public:avm/res/operations-management/solution:<version>' = {
"value": "<logAnalyticsWorkspaceName>"
},
"name": {
"value": "AzureAutomation"
"value": "<name>"
},
"product": {
"value": "SQLAuditing"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"publisher": {
"value": "Microsoft"
}
}
}
```

</details>
<p>

<details>

<summary>via Bicep parameters file</summary>

```bicep-params
using 'br/public:avm/res/operations-management/solution:<version>'

// Required parameters
param logAnalyticsWorkspaceName = '<logAnalyticsWorkspaceName>'
param name = '<name>'
param product = 'SQLAuditing'
// Non-required parameters
param location = '<location>'
param publisher = 'Microsoft'
```

</details>
<p>

### Example 5: _WAF-aligned_

This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework.


<details>

<summary>via Bicep module</summary>

```bicep
module solution 'br/public:avm/res/operations-management/solution:<version>' = {
name: 'solutionDeployment'
params: {
// Required parameters
logAnalyticsWorkspaceName: '<logAnalyticsWorkspaceName>'
name: '<name>'
product: 'OMSGallery/AzureAutomation'
// Non-required parameters
location: '<location>'
publisher: 'Microsoft'
}
}
```

</details>
<p>

<details>

<summary>via JSON parameters file</summary>

```json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
// Required parameters
"logAnalyticsWorkspaceName": {
"value": "<logAnalyticsWorkspaceName>"
},
"name": {
"value": "<name>"
},
"product": {
"value": "OMSGallery"
"value": "OMSGallery/AzureAutomation"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"publisher": {
"value": "Microsoft"
Expand All @@ -325,10 +410,10 @@ using 'br/public:avm/res/operations-management/solution:<version>'

// Required parameters
param logAnalyticsWorkspaceName = '<logAnalyticsWorkspaceName>'
param name = 'AzureAutomation'
param name = '<name>'
param product = 'OMSGallery/AzureAutomation'
// Non-required parameters
param location = '<location>'
param product = 'OMSGallery'
param publisher = 'Microsoft'
```

Expand All @@ -342,15 +427,15 @@ param publisher = 'Microsoft'
| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`logAnalyticsWorkspaceName`](#parameter-loganalyticsworkspacename) | string | Name of the Log Analytics workspace where the solution will be deployed/enabled. |
| [`name`](#parameter-name) | string | Name of the solution. For Microsoft published gallery solution the target solution resource name will be composed as `{name}({logAnalyticsWorkspaceName})`. |
| [`name`](#parameter-name) | string | Name of the solution.<p>For solutions authored by Microsoft, the name must be in the pattern: `SolutionType(WorkspaceName)`, for example: `AntiMalware(contoso-Logs)`.<p>For solutions authored by third parties, the name should be in the pattern: `SolutionType[WorkspaceName]`, for example `MySolution[contoso-Logs]`.<p>The solution type is case-sensitive. |
| [`product`](#parameter-product) | string | The product name of the deployed solution.<p>For Microsoft published gallery solution it should be `OMSGallery/{solutionType}`, for example `OMSGallery/AntiMalware`.<p>For a third party solution, it can be anything.<p>This is case sensitive. |

**Optional parameters**

| Parameter | Type | Description |
| :-- | :-- | :-- |
| [`enableTelemetry`](#parameter-enabletelemetry) | bool | Enable/Disable usage telemetry for module. |
| [`location`](#parameter-location) | string | Location for all resources. |
| [`product`](#parameter-product) | string | The product of the deployed solution. For Microsoft published gallery solution it should be `OMSGallery` and the target solution resource product will be composed as `OMSGallery/{name}`. For third party solution, it can be anything. This is case sensitive. |
| [`publisher`](#parameter-publisher) | string | The publisher name of the deployed solution. For Microsoft published gallery solution, it is `Microsoft`. |

### Parameter: `logAnalyticsWorkspaceName`
Expand All @@ -362,7 +447,14 @@ Name of the Log Analytics workspace where the solution will be deployed/enabled.

### Parameter: `name`

Name of the solution. For Microsoft published gallery solution the target solution resource name will be composed as `{name}({logAnalyticsWorkspaceName})`.
Name of the solution.<p>For solutions authored by Microsoft, the name must be in the pattern: `SolutionType(WorkspaceName)`, for example: `AntiMalware(contoso-Logs)`.<p>For solutions authored by third parties, the name should be in the pattern: `SolutionType[WorkspaceName]`, for example `MySolution[contoso-Logs]`.<p>The solution type is case-sensitive.

- Required: Yes
- Type: string

### Parameter: `product`

The product name of the deployed solution.<p>For Microsoft published gallery solution it should be `OMSGallery/{solutionType}`, for example `OMSGallery/AntiMalware`.<p>For a third party solution, it can be anything.<p>This is case sensitive.

- Required: Yes
- Type: string
Expand All @@ -383,14 +475,6 @@ Location for all resources.
- Type: string
- Default: `[resourceGroup().location]`

### Parameter: `product`

The product of the deployed solution. For Microsoft published gallery solution it should be `OMSGallery` and the target solution resource product will be composed as `OMSGallery/{name}`. For third party solution, it can be anything. This is case sensitive.

- Required: No
- Type: string
- Default: `'OMSGallery'`

### Parameter: `publisher`

The publisher name of the deployed solution. For Microsoft published gallery solution, it is `Microsoft`.
Expand Down
22 changes: 12 additions & 10 deletions avm/res/operations-management/solution/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ metadata name = 'Operations Management Solutions'
metadata description = 'This module deploys an Operations Management Solution.'
metadata owner = 'Azure/module-maintainers'

@description('Required. Name of the solution. For Microsoft published gallery solution the target solution resource name will be composed as `{name}({logAnalyticsWorkspaceName})`.')
@description('''Required. Name of the solution.
For solutions authored by Microsoft, the name must be in the pattern: `SolutionType(WorkspaceName)`, for example: `AntiMalware(contoso-Logs)`.
For solutions authored by third parties, the name should be in the pattern: `SolutionType[WorkspaceName]`, for example `MySolution[contoso-Logs]`.
The solution type is case-sensitive.''')
param name string

@description('Required. Name of the Log Analytics workspace where the solution will be deployed/enabled.')
Expand All @@ -11,8 +14,11 @@ param logAnalyticsWorkspaceName string
@description('Optional. Location for all resources.')
param location string = resourceGroup().location

@description('Optional. The product of the deployed solution. For Microsoft published gallery solution it should be `OMSGallery` and the target solution resource product will be composed as `OMSGallery/{name}`. For third party solution, it can be anything. This is case sensitive.')
param product string = 'OMSGallery'
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
@description('''Required. The product name of the deployed solution.
For Microsoft published gallery solution it should be `OMSGallery/{solutionType}`, for example `OMSGallery/AntiMalware`.
For a third party solution, it can be anything.
This is case sensitive.''')
param product string

@description('Optional. The publisher name of the deployed solution. For Microsoft published gallery solution, it is `Microsoft`.')
param publisher string = 'Microsoft'
Expand Down Expand Up @@ -43,20 +49,16 @@ resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-06
name: logAnalyticsWorkspaceName
}

var solutionName = publisher == 'Microsoft' ? '${name}(${logAnalyticsWorkspace.name})' : name

var solutionProduct = publisher == 'Microsoft' ? 'OMSGallery/${name}' : product

resource solution 'Microsoft.OperationsManagement/solutions@2015-11-01-preview' = {
name: solutionName
name: name
location: location
properties: {
workspaceResourceId: logAnalyticsWorkspace.id
}
plan: {
name: solutionName
name: name
promotionCode: ''
product: solutionProduct
product: product
publisher: publisher
}
}
Expand Down
Loading