Azure-CLI/Powershell Password requirments

后端 未结 2 1261
忘掉有多难
忘掉有多难 2021-01-17 01:16

So i am trying to make a variable match the password requirements for making a virtual machine in azure CLI

to do this it must have 3 of the following !uppercase, 1

2条回答
  •  无人共我
    2021-01-17 01:52

    For the special characters,the regular expression should be the one in the code below.

    You need to use single quote for your regular expression:

    do
    {
    $s=Read-Host -Prompt "please enter a password"
    }
    until($s -like '[A-Z][A-Z][A-Z][a-z][a-z][a-z][0-9][0-9][0-9][!@$#$%^&*()_+\-\=`[`]{};'':`"\\|,.<>\/? ][!@$#$%^&*()_+\-\=`[`]{};'':`"\\|,.<>\/? ][!@$#$%^&*()_+\-\=`[`]{};'':`"\\|,.<>\/? ]')
    
    write-host "complete entering password"
    

    Test result as below:

提交回复
热议问题