Azure-Samples / ms-identity-dotnetcore-b2c-account-management

.NET Core console application using Microsoft Graph for Azure AD B2C user account management.
https://aka.ms/b2c
MIT License
103 stars 68 forks source link

Generate password with Bulk Create option #24

Open Bgany opened 2 years ago

Bgany commented 2 years ago

Hi,

I am using the code in this project to bulk create users in Azure B2C and let this run everyday.

This works perfect but right now I put the password in plain text in the users.json file that is the source for the input. I would like to change this and let the code generate a password (different one for every user).

I also found that there is a passwordHelper.cs file that is used for single user creation. How do I change the code (in either the project code or the users.json file) so that the Bulk Create option also uses this feature to generate a password.

Currently my users.json file looks like this:

{ "users": [ { "extension_***********_TestId": "12345678.1", "displayName": "Test 1234", "givenName": "Test", "surname": "1234", "identities": [{ "signInType": "emailAddress", "issuerAssignedId": "test.1234@test.com" }], "Password": "Test1234" }] }

melkorCBA commented 2 years ago

This makes sense. Currently "bulk create" uses's the given password for each user from the file JSON file.

This is a useful feature to have especially when migrating users between tenants where importing users won't retrieve any passwords. So in that case it'll be good to have some kind of flag to perform password generation.

I'd like to try implementing this feature as my first contribution to the project.