Runbook implement in different environments

Rajendar Talatam (US - IFS) 1 Reputation point
2021-02-25T04:52:03.73+00:00

we have one Automation account , in that we have created run book , which monitors blob container every half an hour ,
but , we have to create 3 scripts for 3 environments and pass the variables .
is there a way we can we can pass scopes like (Stage, UAT ,Prod), so while executing it should take stage and UAt and prod variables respectively .

Thanks
Rajendar

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,129 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vaibhav Chaudhari 38,616 Reputation points
    2021-02-25T05:14:41.143+00:00

    Maybe instead of hardcoding details about environments, use the parameters and pass environment wise parameters to the runbook in different environments

    https://learn.microsoft.com/en-in/azure/automation/runbook-input-parameters

    ----------

    Please don't forget to Accept Answer and Up-vote if the response helped -- Vaibhav


  2. tbgangav-MSFT 10,386 Reputation points
    2021-03-01T08:58:51.6+00:00

    Hi @Rajendar Talatam (US - IFS) ,

    As anonymous userChaudhari informed, 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