web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Random Password

(0) ShareShare
ReportReport
Posted on by 56

How to create random password in PAD

I have the same question (0)
  • eetuRobo Profile Picture
    4,484 Super User 2026 Season 1 on at

    There is no actions to do that since creating passwords/user credentials are not really tasks you would normally want automate.


    You could do it via script. For example I just asked ChatGPT to create such a VBScript and seemed to work:

    eetuRobo_0-1717159185195.png

     


    VBScript code:

     

     

    Function GenerateRandomPassword(length)
     Dim chars, password, i, rndIndex
     chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%%^&*()_+-=[]{}|;':,./<>?" 'characters to be used in the randomized password
    
     Randomize
     password = ""
     For i = 1 To length
     rndIndex = Int((Len(chars) - 1) * Rnd + 1)
     password = password & Mid(chars, rndIndex, 1)
     Next
     GenerateRandomPassword = password
    End Function
    
    Dim length, password
    length = 12 ' Set your desired password length here
    password = GenerateRandomPassword(length)
    
    ' return password to VBScriptOutput
    WScript.Echo password

     

     

     
    That creates random 12 character password with special characters and letters(capitalized and not) and numbers

    eetuRobo_1-1717158944568.png

     

  • Verified answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2026 Season 1 on at

    Hi @zulfa_r ,

     

    There is an action called Create Random Text action this you can use to create random password.

    You just need to set the length of password required.

    Please find the below solution.

    VishnuReddy1997_0-1717206047897.png

     

    (Note:- if you got your solution you can mark as solution and gives kudos)


    Thanks & Regards

    Vishnu Reddy

  • Verified answer
    Riyaz_riz11 Profile Picture
    4,048 Super User 2026 Season 1 on at

    Hi,

     

    Refer this solution.

    Solved: Re: How to generate random password in power autom... - Power Platform Community (microsoft.com)

     

    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    Regards,
    Riyaz

  • AK88 Profile Picture
    453 on at

    Hi @zulfa_r,

    kindly check the below snippet of code , this will create a random password with shuffling with different character types including special symbols. Hope it works.

     

     

     

     

    Function GenerateRandomPassword(length)
     Dim upperChars, lowerChars, numberChars, specialChars
     Dim password, i, rndIndex
     Dim requiredChars, tempArray(), shuffled
     Dim strLen
    
     ' Characters to be used in the randomized password
     upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     lowerChars = "abcdefghijklmnopqrstuvwxyz"
     numberChars = "0123456789"
     specialChars = "!@#$%^&*()_+-=[]{}|;':,./<>?"
    
     Randomize
     password = ""
    
     ' Ensure at least one character from each category
     password = Mid(upperChars, Int(Len(upperChars) * Rnd + 1), 1)
     password = password & Mid(lowerChars, Int(Len(lowerChars) * Rnd + 1), 1)
     password = password & Mid(numberChars, Int(Len(numberChars) * Rnd + 1), 1)
     password = password & Mid(specialChars, Int(Len(specialChars) * Rnd + 1), 1)
    
     ' Remaining characters to fulfill the desired length
     requiredChars = upperChars & lowerChars & numberChars & specialChars
    
     For i = 5 To length ' Start from 5 since we already added 4 characters
     rndIndex = Int(Len(requiredChars) * Rnd + 1)
     password = password & Mid(requiredChars, rndIndex, 1)
     Next
    
     ' Shuffle the password to avoid predictable order
     shuffled = ShuffleString(password)
    
     GenerateRandomPassword = shuffled
    End Function
    
    Function ShuffleString(str)
     Dim i, pos, temp, strLen
     Dim tempArray()
     strLen = Len(str)
     ReDim tempArray(strLen - 1)
    
     For i = 1 To strLen
     tempArray(i - 1) = Mid(str, i, 1)
     Next
    
     For i = 0 To UBound(tempArray)
     pos = Int((UBound(tempArray) + 1) * Rnd)
     temp = tempArray(i)
     tempArray(i) = tempArray(pos)
     tempArray(pos) = temp
     Next
    
     ShuffleString = JoinArray(tempArray)
    End Function
    
    Function JoinArray(arr)
     Dim result, i
     result = ""
     For i = LBound(arr) To UBound(arr)
     result = result & arr(i)
     Next
     JoinArray = result
    End Function
    
    Dim length, password
    length = 12
    password = GenerateRandomPassword(length)
    
    
    WScript.Echo password

     

     

    Also check with PAD on this action 'Create Random Text', this will also give a designated result, Kindly check.

    AK88_0-1717307410872.png

     

    thanks,

    If my solution resolved your query, kindly mark it as solution and give thumps up!

  • AK88 Profile Picture
    453 on at

    Hi @zulfa_r ,

     

    Kindly check the below snippet of code using Vb script to generate the random string as Password, which includes all character types as required.

     

     

     

    Function GenerateRandomPassword(length)
     Dim upperChars, lowerChars, numberChars, specialChars
     Dim password, i, rndIndex
     Dim requiredChars, tempArray(), shuffled
     Dim strLen
    
     ' Characters to be used in the randomized password
     upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     lowerChars = "abcdefghijklmnopqrstuvwxyz"
     numberChars = "0123456789"
     specialChars = "!@#$%^&*()_+-=[]{}|;':,./<>?"
    
     Randomize
     password = ""
    
     ' Ensure at least one character from each category
     password = Mid(upperChars, Int(Len(upperChars) * Rnd + 1), 1)
     password = password & Mid(lowerChars, Int(Len(lowerChars) * Rnd + 1), 1)
     password = password & Mid(numberChars, Int(Len(numberChars) * Rnd + 1), 1)
     password = password & Mid(specialChars, Int(Len(specialChars) * Rnd + 1), 1)
    
     ' Remaining characters to fulfill the desired length
     requiredChars = upperChars & lowerChars & numberChars & specialChars
    
     For i = 5 To length ' Start from 5 since we already added 4 characters
     rndIndex = Int(Len(requiredChars) * Rnd + 1)
     password = password & Mid(requiredChars, rndIndex, 1)
     Next
    
     ' Shuffle the password to avoid predictable order
     shuffled = ShuffleString(password)
    
     GenerateRandomPassword = shuffled
    End Function
    
    Function ShuffleString(str)
     Dim i, pos, temp, strLen
     Dim tempArray()
     strLen = Len(str)
     ReDim tempArray(strLen - 1)
    
     For i = 1 To strLen
     tempArray(i - 1) = Mid(str, i, 1)
     Next
    
     For i = 0 To UBound(tempArray)
     pos = Int((UBound(tempArray) + 1) * Rnd)
     temp = tempArray(i)
     tempArray(i) = tempArray(pos)
     tempArray(pos) = temp
     Next
    
     ShuffleString = JoinArray(tempArray)
    End Function
    
    Function JoinArray(arr)
     Dim result, i
     result = ""
     For i = LBound(arr) To UBound(arr)
     result = result & arr(i)
     Next
     JoinArray = result
    End Function
    
    Dim length, password
    length = 12 ' Set your desired password length here
    password = GenerateRandomPassword(length)
    
    ' Return password to VBScriptOutput
    WScript.Echo password

     

     

     

    Also, try with PAD action 'Create Random Text' to generate random string in a variable. Sharing the screenshot below. Hope both methods will suitable for your query. 

     

    AK88_0-1717307866651.png

    thanks,

    if it resolved your query, kindly mark it as solution and give thumps Up!

  • AK88 Profile Picture
    453 on at

    Hi @zulfa_r ,

     

    Kindly check the below snippet of code using Vb script to generate the random string as Password, which includes all character types as required.

     

    @@copilotGeneratedAction: 'False'
    DISABLE Scripting.RunVBScript.RunVBScript VBScriptCode: `Function GenerateRandomPassword(length)
     Dim upperChars, lowerChars, numberChars, specialChars
     Dim password, i, rndIndex
     Dim requiredChars, tempArray(), shuffled
     Dim strLen
    
     ' Characters to be used in the randomized password
     upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
     lowerChars = "abcdefghijklmnopqrstuvwxyz"
     numberChars = "0123456789"
     specialChars = "!@#$%^&*()_+-=[]{}|;':,./<>?"
    
     Randomize
     password = ""
    
     ' Ensure at least one character from each category
     password = Mid(upperChars, Int(Len(upperChars) * Rnd + 1), 1)
     password = password & Mid(lowerChars, Int(Len(lowerChars) * Rnd + 1), 1)
     password = password & Mid(numberChars, Int(Len(numberChars) * Rnd + 1), 1)
     password = password & Mid(specialChars, Int(Len(specialChars) * Rnd + 1), 1)
    
     ' Remaining characters to fulfill the desired length
     requiredChars = upperChars & lowerChars & numberChars & specialChars
    
     For i = 5 To length ' Start from 5 since we already added 4 characters
     rndIndex = Int(Len(requiredChars) * Rnd + 1)
     password = password & Mid(requiredChars, rndIndex, 1)
     Next
    
     ' Shuffle the password to avoid predictable order
     shuffled = ShuffleString(password)
    
     GenerateRandomPassword = shuffled
    End Function
    
    Function ShuffleString(str)
     Dim i, pos, temp, strLen
     Dim tempArray()
     strLen = Len(str)
     ReDim tempArray(strLen - 1)
    
     For i = 1 To strLen
     tempArray(i - 1) = Mid(str, i, 1)
     Next
    
     For i = 0 To UBound(tempArray)
     pos = Int((UBound(tempArray) + 1) * Rnd)
     temp = tempArray(i)
     tempArray(i) = tempArray(pos)
     tempArray(pos) = temp
     Next
    
     ShuffleString = JoinArray(tempArray)
    End Function
    
    Function JoinArray(arr)
     Dim result, i
     result = ""
     For i = LBound(arr) To UBound(arr)
     result = result & arr(i)
     Next
     JoinArray = result
    End Function
    
    Dim length, password
    length = 12 ' Set your desired password length here
    password = GenerateRandomPassword(length)
    
    ' Return password to VBScriptOutput
    WScript.Echo password` ScriptOutput=> VBScriptOutput

     

     

     

     

    Also, try with PAD action 'Create Random Text' to generate random string in a variable. Sharing the screenshot below. Hope both methods will suitable for your query. 

     

    AK88_1-1717308733593.png

     

    thanks,

    if it resolved your query, kindly mark it as solution and give thumps Up!

  • Verified answer
    AK88 Profile Picture
    453 on at

    Hi @zulfa_r ,

     

    Also, try with PAD action 'Create Random Text' to generate random string in a variable. Sharing the screenshot below. Hope both methods will suitable for your query. 

     

    AK88_2-1717308887430.png

     

     

    thanks,

    if it resolved your query, kindly mark it as solution and give thumps Up!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard