Skip to content

Commit

Permalink
fix: ARM template schema that does not install LA workspace
Browse files Browse the repository at this point in the history
ASIM parser installation ARM templates should only install the saved
search if the Log Analytics workspace already exists.

Relates: Azure#8623
  • Loading branch information
frendsick committed Oct 22, 2024
1 parent a19ca8a commit dd86c48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
12 changes: 6 additions & 6 deletions ASIM/dev/ASimYaml2ARM/KqlFuncYaml2Arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
logging.debug ('Generating ARM template')
# generate the ARM template
armTemplate = copy.deepcopy(func_arm_template)
armTemplate['resources'][0]['resources'][0]['name'] = Alias
armTemplate['resources'][0]['resources'][0]['properties']['query'] = Query
armTemplate['resources'][0]['resources'][0]['properties']['category'] = Category
armTemplate['resources'][0]['name'] = f"[concat(parameters('Workspace'), '/{Alias}')]"
armTemplate['resources'][0]['properties']['query'] = Query
armTemplate['resources'][0]['properties']['category'] = Category
if params:
Parameters = ""
for param in params:
Expand All @@ -220,9 +220,9 @@
if Parameters != "":
Parameters = f'{Parameters},'
Parameters = Parameters + ParamString
armTemplate['resources'][0]['resources'][0]['properties']['functionParameters'] = Parameters
armTemplate['resources'][0]['resources'][0]['properties']['FunctionAlias'] = Alias
armTemplate['resources'][0]['resources'][0]['properties']['displayName'] = Title
armTemplate['resources'][0]['properties']['functionParameters'] = Parameters
armTemplate['resources'][0]['properties']['FunctionAlias'] = Alias
armTemplate['resources'][0]['properties']['displayName'] = Title

logging.debug ('Writing ARM template')
# Write template
Expand Down
32 changes: 11 additions & 21 deletions ASIM/dev/ASimYaml2ARM/func_arm_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,18 @@
},
"resources": [
{
"type": "Microsoft.OperationalInsights/workspaces",
"apiVersion": "2017-03-15-preview",
"name": "[parameters('Workspace')]",
"type": "Microsoft.OperationalInsights/workspaces/savedSearches",
"apiVersion": "2020-08-01",
"name": "resourceName",
"location": "[parameters('WorkspaceRegion')]",
"resources": [
{
"type": "savedSearches",
"apiVersion": "2020-08-01",
"name": "functionAlias",
"dependsOn": [
"[concat('Microsoft.OperationalInsights/workspaces/', parameters('Workspace'))]"
],
"properties": {
"etag": "*",
"displayName": "displayName",
"category": "ASIM",
"FunctionAlias": "functionAlias",
"query": "parserQuery",
"version": 1
}
}
]
"properties": {
"etag": "*",
"displayName": "displayName",
"category": "ASIM",
"FunctionAlias": "functionAlias",
"query": "parserQuery",
"version": 1
}
}
]
}

0 comments on commit dd86c48

Please sign in to comment.