dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
584 stars 273 forks source link

Create User not working #263

Closed joshuajcone closed 9 months ago

joshuajcone commented 10 months ago

Hello, using the Invoke-CreateIdracUserPasswordREDFISH I am unable to create a new user, and it does not report an error code.

If I use this example, it only prompts for the authenticating user, but not the new user Invoke-CreateIdracUserPasswordREDFISH -idrac_ip 192.168.0.120 -idrac_user_id 3 -idrac_user_privilege ReadOnly -idrac_user_enable true

If I use this example, it does nothing. Invoke-CreateIdracUserPasswordREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password calvin -idrac_user_id 3 -idrac_new_username user3 -idrac_new_password test123 -idrac_user_privilege ReadOnly -idrac_user_enable true

texroemer commented 10 months ago

Hi @joshuajcone

Thanks for reporting the issue, i have fixed the bug and uploaded cmdlet to GitHub and Powershell gallery. Example below of running the updated cmdlet.

1. Confirm user account ID 16 does not exist.

PS C:\> Invoke-CreateIdracUserPasswordREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password Test1234# -get_idrac_user_accounts -idrac_user_id 16

- INFO, executing GET command to get iDRAC user account 16 information

@odata.context         : /redfish/v1/$metadata#ManagerAccount.ManagerAccount
@odata.etag            : "752100"
@odata.id              : /redfish/v1/AccountService/Accounts/16
@odata.type            : #ManagerAccount.v1_10_0.ManagerAccount
AccountTypes           : {Redfish, SNMP, OEM, HostConsole...}
Description            : User Account
Enabled                : False
Id                     : 16
Keys                   : @{@odata.id=/redfish/v1/AccountService/Accounts/16/Keys}
Links                  : @{Role=}
Locked                 : False
Name                   : User Account
OEMAccountTypes        : {IPMI, SOL, WSMAN, UI...}
Oem                    : @{Dell=}
Password               :
PasswordChangeRequired : False
PasswordExpiration     :
RoleId                 : None
SNMP                   : @{AuthenticationKey=; AuthenticationKeySet=False; AuthenticationProtocol=HMAC_SHA96; EncryptionKey=; EncryptionKeySet=False; EncryptionProtocol=CFB128_AES128}
StrictAccountTypes     : False
UserName               :

2. Create iDRAC user account ID 16. 

PS C:\> Invoke-CreateIdracUserPasswordREDFISH -idrac_ip 192.168.0.120 -idrac_username root -idrac_password Test1234# -idrac_user_id 16 -idrac_user_privilege Operator -idrac_user_enable true

- PASS, statuscode 200 returned successfully for PATCH command to create iDRAC user
- PASS, iDRAC user ID '16' successfully created

3. Test iDRAC user account 16, confirm it works. 

PS C:\> Invoke-CreateIdracUserPasswordREDFISH -idrac_ip 192.168.0.120 -idrac_username tester -idrac_password Test789# -get_idrac_user_accounts -idrac_user_id 16

- INFO, executing GET command to get iDRAC user account 16 information

@odata.context         : /redfish/v1/$metadata#ManagerAccount.ManagerAccount
@odata.etag            : "865552"
@odata.id              : /redfish/v1/AccountService/Accounts/16
@odata.type            : #ManagerAccount.v1_10_0.ManagerAccount
AccountTypes           : {Redfish, SNMP, OEM, HostConsole...}
Description            : User Account
Enabled                : True
Id                     : 16
Keys                   : @{@odata.id=/redfish/v1/AccountService/Accounts/16/Keys}
Links                  : @{Role=}
Locked                 : False
Name                   : User Account
OEMAccountTypes        : {IPMI, SOL, WSMAN, UI...}
Oem                    : @{Dell=}
Password               :
PasswordChangeRequired : False
PasswordExpiration     :
RoleId                 : Operator
SNMP                   : @{AuthenticationKey=; AuthenticationKeySet=True; AuthenticationProtocol=HMAC_SHA96; EncryptionKey=; EncryptionKeySet=True; EncryptionProtocol=CFB128_AES128}
StrictAccountTypes     : False
UserName               : tester

If you still see issues please let me know.

Thanks Tex