German speaking users often face encoding issues in Azure child runbooks, which are caused by special characters such as "ä", "ö" and "ü". Martin Heusser has demonstrated the problem using an Azure Runbook that sends a message card to a Teams channel with "Hello Wörld!" as the text. It works correctly when there is no child runbook involved, but the encoding becomes incorrect once another runbook is initiated. Learn more.
In complex scenarios, you may want to construct modular runbooks. Heusser suggests using a main runbook or child runbook setup and multiple other runbooks that call your main runbook inline. With this setup, you only need to modify the code in one place. Nonetheless, Heusser found that the encoding gets flawed and special characters are sent to Teams in the wrong format if a child runbook is called inline from another runbook.
The trick is to store the special characters inside a variable. This works well if you have one main runbook that sends message cards to Teams, and numerous different runner scripts that will send various kinds of messages. Heusser acknowledges that keeping up with the code could get complicated given this situation.
Utilizing Automation Variables is another solution. You can place the entire code into an Automation Variable as a string which is saved inside the Automation Account and accessible by all runbooks within it. The runner script can import the Automation Variable. It allows you to change the value of the variable without altering any of your runner scripts.
Yet another workaround is storing the code in another runbook for easier editing and testing directly in the browser. In an attempt to keep the encoding intact, one should use Invoke-Expression instead of invoking the runbook directly. Thus, the externally stored code will run in the runner script's scope, not the child runbook's. This not just ensures correct encoding, but also allows easy updating of runbooks.
Azure runbooks enable users to create robust automation procedures. However, when dealing with languages that involve special characters, such as German, encoding issues might occur, specifically with UTF-8 encoding. In the context of using Azure Automation, these problems often emerge when child runbooks are applied.
Child runbooks, also known as modular runbooks, are a method of creating reusable components in an Azure environment. The nature of these components makes it highly modular and scalable as changes to the main runbook doesn't affect the parent or runner script.
However, users may encounter issues with encoding when initiating Azure Automation from another runbook. The encoding of special characters could go wrong, which might significantly disrupt your operational processes. Several workarounds exist to tackle this issue, ranging from storing the special characters in a variable to using Automation Variables or PowerShell Runbooks.
While these solutions have proved effective in addressing encoding issues, it's essential to approach them according to your specific operational needs to ensure seamless automation and optimal efficiency in your Azure environment.
Read the full article Fix UTF-8 Encoding When Calling Azure Child Runbooks Inline
If you are dealing with Azure Runbooks and UTF-8 encoding and you encounter issues with special characters, this post is specifically for you. However, it also provides general tips and tricks for anyone working with Azure Runbooks. The author had issues with Umlaute, special characters used in German, such as “ä”, “ö” and “ü”.
In simpler scenarios, everything worked fine for the author. But the encoding issues arose when working with more complex tasks, more specifically, with child Runbooks. A child Runbook might be called inline from another Runbook.
The author found a workaround to this problem by storing the special characters inside a variable, which was known to the runner script. This way, the first Runbook knew the correct encoding and it worked properly.
However, it was problematic to maintain this system, especially when multiple runner scripts sent different messages. To ease maintenance and ensure correct encoding, the author used Automation Variables to store the special characters as a string.
On a downside, editing the code might become a bit tricky, because it's stored inside a variable without any syntax checking. Therefore, the author suggests moving the string into a local IDE (e.g., VS Code) for updating and then back into the Automation Variable.
Further improvements made use of separate PowerShell Runbooks for storing special character data, which made editing and testing easier. But for this, the author required additional modules in the Automation Account, and a Managed Identity.
The author tested their solution on a range of scenarios and it worked. Special character encoding was intact and was updated easily in all the scripts. However, the author mentions that it is still unclear why the issue arose in the first place when special characters were included explicitly in child Runbooks.
To learn to handle a similar scenario and gain detailed knowledge about Azure Runbooks, child Runbooks, Automation Variables and more, you might find these Microsoft resources useful:
If you want to deepen your knowledge about UTF-8 encoding, these resources might help:
Fix UTF-8 Encoding, Azure Child Runbooks, Inline Runbooks, Azure Encoding, Fix Azure Runbooks, UTF-8 Encoding Problem, Azure Inline Encoding, Runbook Encoding Fix, UTF-8 Azure, Child Runbook Correction.