PowerShell can help to simplify Azure AD management. This tutorial explains how to install the Azure AD PowerShell module and establish a connection to Azure AD.
This guide explains the process for signing PowerShell script. You will learn how to create an enterprise certificate authority, acquire a certificate, and use that certificate to sign a PowerShell script.
It is easy to export your PowerShell command history to make a script. However, you will need to remove unwanted items like column headers and command ID numbers.