0 vote
Hi,
I'm using RDM 2020.2.13 with MSSQL
I've around 100 new users to create. Maybe I can create it with powershell but that could great to be able to import from a csv or txt file with seperator like comma in User And Security Management in RDM. Like import users from file...
See fields I need to import to create the users.
username: integrated security
user type: user
First name: Test
Last name: test
Email: test@test.com
Department: Example Technical support
Roles: set one or more roles
It's possible or only powershell will be the option?
Regards
Hello,
We don't support batch user import. I will create a feature request but I can't give you a timeframe.
Regards
David Hervieux
Hi,
good!
Pending the batch user import feature there's a way with powershell in RDM to create user with all fields I've mention?
Regards
Hello,
I will send you a sample PowerShell script in a private message that will help you to create SQL accounts in RDM.
Best regards,
Érica Poirier
Hello,
i am interrested with the batch.
i need to import 250 users from my active directory
regards
Hello,
I have sent you a private message that contains the script.
Best regards,
Érica Poirier
Hello,
it seems perfect ! :)
regards
Please, send me this script to - thank you
Hello,
I will send you a sample PowerShell script in a private message that will help you to create SQL accounts in RDM.
Best regards,
Hello,
@it-support01 I have sent you a private message with the script.
Best regards,
Érica Poirier
Hello,
@it-support01 I have sent you a private message with the script.
Best regards,
Thank you much!
Hello,
Can i get a copy of that script please.
Thanks
Hello,
@rogerv As requested, I have sent the PowerShell script in a private message.
Best regards,
Érica Poirier
Hello Erica:
Please, send me this script also.
Thanks.
Hello,
@Andrew I have sent you the script in a private message. This script is working for SQL data source. If you are using DVLS, it won't work properly. We recommend enabling the Automatic User Creation option in the Domain or Office365 setting page.
https://helpserver.devolutions.net/authentication_domain.html#automatic-user-creation
https://helpserver.devolutions.net/authentication_office365.html#automatic-user-creation
Best regards,
Érica Poirier
Erica,
Can I get a copy of the script as well for importing users. I am using SQL Datasource as well.
Regards,
Sriram
Hello,
You can find the script under our GitHub RDM sample page: https://github.com/Devolutions/RDMSamples-ps/blob/main/module/security/BulkSQLUserCreation.ps1
If you are using version 2021.2.x of RDM, replace the import-module line with import-module RemoteDesktopManager
Best regards,
Richard Boisvert
Will this work if the DB is Azure SQL?
Also, is there any special formatting needed for the names of columns in the csv file?
Thanks
I am guessing it doesn't work. Running this command: New-RDMUser -Login $Email -Email $Email -AuthenticationType AzureAD doesn't work. I get this error (i replaced the server name with domain so not to expose our tenant):
New-RDMUser : Cannot open server "domain" requested by the login. The login failed.
At line:1 char:20
+ ... $newUser = New-RDMUser -Login $Email -Email $Email -AuthenticationTy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-RDMUser], SqlException
+ FullyQualifiedErrorId : System.Data.SqlClient.SqlException,RemoteDesktopManager.PowerShellModule.NewRDMUserCommand
I am able to create users manually so this script is not passing my credentials when trying to create in Azure SQL. I guess this isn't supported?
Hello,
I tried with the same cmdlet you used, but with -SetUser, and it worked as expected. What version of RDM are you using (displayed in the bottom right corner), and the version of the RDM PowerShell module - Get-RDMInstance ?New-RDMUser -Login "testLogin" -Email "test@test.com" -AuthenticationType AzureAD -SetUser
Best regards,
Richard Boisvert
Richard,
Thanks for updating this, however, i get the exact same error even with -SetUser at the end. I am running 2021.2.28.0 64-BIT and 2021.2.0.43 of the powershell module. I did want to mention that when I run get-rdmdatasource, i get this message about being unable to open the server. I am willing to bet this is my issue. Any thoughts on why this is happening and how to fix it?
I should mention that i had been running on .42 of the powershell module but just updated it to .43. That appears to have broken the switches for email and authentication type since they are no longer options:
Hello,
When using an Azure SQL, you cannot use an account with interactive authentication (0365) for the scripts. It is not supported with the new RDM module because the backend is not available in PowerShell Core. You would need to use a database user to be able to connect to the data source.
I checked with the engineer in charge of the module, it seems to be an issue with the documentation, but the switches are still present. It will be fixed at a later date.
Best regards,
Richard Boisvert
When using an Azure SQL, you cannot use an account with interactive authentication (0365) for the scripts. It is not supported with the new RDM module because the backend is not available in PowerShell Core. You would need to use a database user to be able to connect to the data source.
Thanks for the info. Can you explain to me how I would perform this as the DB user? I am not a SQL expert here so I might need some hand holding. Thanks.
Hello,
You would need to create a database user (point 4 below) - under Administration > Users > Add User. Depending on what you need to do, you will probably need to make it an admin (point 5).
You can then configure a data source to use that account:
In PowerShell, you can set the data source to use with the following:
$ds = Get-RDMDataSource -Name "NameOfYourDataSourceHere" Set-RDMCurrentDataSource $ds
Best regards,
Richard Boisvert
Yes, that worked. Thank you! Documentation is so important :)
Are you planning on including an import feature instead of relying on this method? That would really solve all these complexities for future users.
At any rate, thank you for assisting me with this!
Just wanted to update this thread. I ran the powershell script in production and it was able to add over 200 users, which is great. However, upon testing with one of my colleagues, we noticed that he got a token error when trying to test the DB. I then removed his account and just recreated it and afterwards the user was able to connect successfully. He did not alter her username or password from the screen while I recreated his account.
Is there a way i can query the Azure DB to see if the user accounts were actually created or not? It seems the script only makes superficial changes and doesn't actually create a login for the users on the DB side. Please advise. Thanks.
Hello,
For the importing feature, it is only available with Devolutions Server: https://devolutions.net/server/. It also allows to have automatic user creation and to import security groups to set the permissions, along with added security features, emails, PAM, Gateway, etc.
To validate the users are created on the SQL side, it would be in the UserSecurity table:
SELECT * FROM [dbo].[UserSecurity]
Best regards,
Richard Boisvert
Richard,
Thank you, that did work. I noticed that I to select all the users in the list and then click the Fix SQL Login button in order to get them all to show up. Is that something that can be incorporated into the PowerShell function? If not, this isn't a huge deal but it should be something anyone who uses this should know about it. Thanks.
Hello,
I will try to replicate the issue and will open an internal ticket; I will keep you posted.
Best regards,
Richard Boisvert
Hello,
After verifying and testing with the engineering team, it is not possible to make an Azure AD user in an Azure SQL from PowerShell using a database user. You will need to continue doing the Fix SQL Login after the users are created.
The engineer is looking into adding a validation for the New-RDMUser, however, so it will help in the future.
Best regards,
Richard Boisvert