question

RajendarTalatamUSIFS-0980 avatar image
0 Votes"
RajendarTalatamUSIFS-0980 asked ·

Runbook implement in different environments

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
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RajendarTalatamUSIFS-0980,

Did you get chance to review the below information shared by @VaibhavChaudhari ?

Probable duplicate - https://docs.microsoft.com/en-us/answers/questions/286466/index.html

Let us know if you have any further queries regarding it.

0 Votes 0 ·

Hi @RajendarTalatamUSIFS-0980,

Did you get chance to review the below recent response? Let me know if you have any further queries regarding it.

0 Votes 0 ·
VaibhavChaudhari avatar image
0 Votes"
VaibhavChaudhari answered ·

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

https://docs.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 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

when we are running how we can schedule runbook to specific environment ?.
means how we can pass environment details ?

0 Votes 0 ·

How to configure runbook in different environments ?
we have only one automation account . then I have only one choice to create 3 different runbook for 3 environments.
this is not ideal as we need to create 3 script with same code . please let me know solution for this ?

0 Votes 0 ·
tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered ·

Hi @RajendarTalatamUSIFS-0980,

As @VaibhavChaudhari 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.


image.png (83.9 KiB)
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.