Hello, please ensure you're using an Azure AD app registration which differs from a B2C app registration, the later does not support MS Graph. Also that the user being authenticated has directory permissions to create users, such as belonging to a role like User Administrator.
Please let me know if you need more help. If the answer was helpful to you, please accept it and, optionally, provide feedback so that other members in the community can benefit from it.