Password Generation - MS Graph

Ayan Usmani 141 Reputation points

I am creating a user using MS API to create user. While doing so I am randomly generating a password via my python script which is being send in the api request body.

But it fails due to password not complying the complexity.

Is there any way to get random password genearated from MS api OR any suggested library in python which complies with MS password complexity policy.

Microsoft Graph Users API
Microsoft Graph Users API
A Microsoft API that allows you to build compelling app experiences based on users, their relationships with other users and groups, and the resources they access for example their mails, calendars, files, administrative roles, group memberships.
726 questions
0 comments No comments
{count} votes

Accepted answer
  1. Dillon Silzer 40,031 Reputation points

    Hi @Ayan Usmani

    Password requirements:


    Cited from


    import random  
    import string  
    # get random password pf length 8 with letters, digits, and symbols  
    characters = string.ascii_letters + string.digits + string.punctuation  
    password = ''.join(random.choice(characters) for i in range(8))  

    Cited from

    Reference to Create User (Graph API):


    If this is helpful please accept answer.

    0 comments No comments

0 additional answers

Sort by: Most helpful