Azure / Azure/bicep

Add property "scriptContent" and "environmentVariables" to Microsoft.Automation/automationAccounts/runbooks

Open
#7,966 0 comments 4 reactions 0 assignees View on GitHub
enhancement provider improvement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

I deployed an automation account with runbooks. To put content in a runbook you can only point to an online file using "publishContentLink". There's no way to point to a local file. I used a "Microsoft.Resources/deploymentScripts" to create a runbook but it's complicated as well. It would be much easier to create runbooks if there was two properties: "scriptContent" and "environmentVariables" in "Microsoft.Automation/automationAccounts/runbooks". Like there is in "Microsoft.Resources/deploymentScripts".

```
resource runbook01 'Microsoft.Automation/automationAccounts/runbooks@2019-06-01' = {
name: 'Runbook01'
parent: aa
location: location
tags: tags
properties: {
runbookType: 'PowerShell'
logVerbose: false
logProgress: false
logActivityTrace: 0
description: 'Fileshare on-demand snapshot'
publishContentLink: {
uri: 'https://raw.githubusercontent.com/petitess/powershell/main/Azure/Remove-AzStorageBlob01.ps1'
}
}
}
```

```
resource script01 'Microsoft.Resources/deploymentScripts@2020-10-01' = {
name: 'runbook-script02'
location: locatonalt
kind: 'AzurePowerShell'
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${id.id}': {}
}
}
properties: {
azPowerShellVersion: '5.0'
retentionInterval: 'PT1H'
timeout: 'PT10M'
cleanupPreference: 'Always'
environmentVariables: [
{
name: 'rgname'
value: resourceGroup().name
}
]
scriptContent: loadTextContent('script01.ps1')
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by comparing the Microsoft.Automation/automationAccounts/runbooks@2019-06-01 properties with Microsoft.Resources/deploymentScripts@2020-10-01, focusing on the script01.ps1 and environmentVariables examples in the issue. Confirm whether the Azure resource API supports these properties and identify the Bicep resource-definition entry point. Done means local script content and environment variables can be declared for runbooks and are validated by appropriate coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.