Howdy, I would like to share the list of the extremely useful FREE courses with you which can help you to prepare for Azure exams and level up your skills in the most efficient way. Tons of videos, hands-on labs and text guidances. You just need to find a free time and passion, plus make sure that you have an active Azure subscription (trial is an option).
#Import Rights Management module
#Get credentials (global administrator)
$cred=Get-Credential -Credential rlevchenko@<tenantname>.onmicrosoft.com
#Connect to RM Service and activate it.
Connect-AadrmService -Credential $cred -Verbose
A connection to the Windows Azure AD Rights Management (AADRM) service was opened for rlevchenko@<tenantname>.onmicrosoft.com.
The Rights Management service has been successfully enabled although additional
configuration of other services might be required. For more information, see h
#Add user to RMS administrators group
Add-AadrmRoleBasedAdministrator -EmailAddress "user1@<tenantname>.onmicrosoft.com"
user1@<tenantname>..onmicrosoft.com was added to the list of administrators for the
Rights Management service.
#Disconnect from RM Service
Connection to the AADRM service closed.
#I have already connected to MS online so it's not necessary to execute Connect-MSolService.
#Reset user's password to random password. User will be required to set new password on the next sign in.
Set-MsolUserPassword -UserPrincipalName user2@<tenantname>.onmicrosoft.com
#....Not to random password
Set-MsolUserPassword -UserPrincipalName user2@<tenantname>.onmicrosoft.com -NewPassword Pass123!
#Set expiration of password
Set-MsolUser -UserPrincipalName user2@<tenantname>.onmicrosoft.com -PasswordNeverExpires $true
#Set password expiration policy
Set-MsolPasswordPolicy -DomainName <tenantname>.onmicrosoft.com -ValidityPeriod 90 -NotificationDays 14
#Get password expiration policy
Get-MsolPasswordPolicy -DomainName <tenantname>.onmicrosoft.com
ExtensionData NotificationDays ValidityPeriod
------------- ---------------- --------------
System.Runtime.Serializ... 14 90
#First step it is to delete user with "soft" option
Remove-MsolUser -UserPrincipalName user3@<tenantname>.onmicrosoft.com -Force
#Delete user from recycle bin = hard delete
Remove-MsolUser -UserPrincipalName user3@<tenantname>.onmicrosoft.com -RemoveFromRecycleBin -Force