Generate a random string for passwords
This article explains how to generate random strings, which is useful for things like creating passwords.
How to build the scenario
Section titled “How to build the scenario”Implement by copying and pasting
Section titled “Implement by copying and pasting”Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.
Text.Random UseUpperCaseLetters: True UseLowerCaseLetters: True UseDigits: True UseSymbols: True MinimumLength: 6 MaximumLength: 10 RandomText=> RandomTextImplement in Power Automate Desktop
Section titled “Implement in Power Automate Desktop”-
In “Search actions”, type “Create random text” and set the parameters as follows.
Parameter Value Use uppercase letters (A-Z) Turn on to allow uppercase letters Use lowercase letters (a-z) Turn on to allow lowercase letters Use digits (0-9) Turn on to allow digits Use symbols Turn on to allow symbols Minimum length The minimum number of characters to generate Maximum length The maximum number of characters to generate -
Save and run the flow to generate a random string that changes on every run. If you specify the same value for the minimum and maximum length, you can fix the number of characters.
Set more complex rules
Section titled “Set more complex rules”If you need rules for specific character positions, you need to create several random strings and then join them.
As an example, this section generates a string whose first 2 characters are always digits and whose remaining 6 characters are letters.
Implement by copying and pasting
Section titled “Implement by copying and pasting”Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.
Text.Random UseUpperCaseLetters: False UseLowerCaseLetters: False UseDigits: True UseSymbols: False MinimumLength: 2 MaximumLength: 2 RandomText=> RandomText1Text.Random UseUpperCaseLetters: True UseLowerCaseLetters: True UseDigits: False UseSymbols: False MinimumLength: 6 MaximumLength: 6 RandomText=> RandomText2Text.JoinText.Join List: [RandomText1, RandomText2] Result=> JoinedTextImplement in Power Automate Desktop
Section titled “Implement in Power Automate Desktop”-
Using the method described above, generate two random strings (RandomText1 and RandomText2) with “Create random text”.
-
In “Search actions”, search for “Join text” and set the parameters as follows.
Parameter Value Specify the list to join %[RandomText1, RandomText2]% Delimiter to separate list items None -
When you run the flow, a random string that follows the rules is generated.