A community member has associated this post with a similar question:
Runbook implement in different environments

Only moderators can edit this content.

Azure RunBook implenetattion for diff environment

Rajendar Talatam (US - IFS) 1 Reputation point
2021-02-24T08:05:54.347+00:00

Hi All ,
We have started migration one script to Azure Runbook , the problem we are facing is , we need to create
3 script for all three environments(prod, UAT ,Stage).
is there any we can mitigate this issues , by using single automation account :

our environment:

1) one Automation Account
2)we have one ps script which we configured through source control in Automation account
3) it is exposing as run book
4) we have some input variables .
As the input var values are diff for diff environments we need to create 2 more scripts for (UAT and Prod ).

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,114 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,364 questions
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,381 Reputation points
    2021-03-04T06:57:25.32+00:00

    Hi @Rajendar Talatam (US - IFS) ,

    You could use runbook parameters and have a single runbook with your environment name as a parameter. In the stage where you get the environment name for which your runbook has to run, in that level itself you could remotely create schedule with the help of New-AzAutomationSchedule Az PowerShell cmdlet and then remotely configure the schedule of the runbook specific to particular environment with the help of Register-AzAutomationScheduledRunbook Az PowerShell cmdlet's parameter section. For reference, please check below screenshot.

    72922-image.png

    If you have further queries on how to automatically get the environment name for which your runbook has to run and configure the schedule, then please provide end-to-end context of your use case i.e., where and how do you define that runbook has to run for a particular environment at a given point of time, what are the services, tools or technologies involved, etc.

    0 comments No comments