Microsoft products give me a hard time due to their incredibly poor documentation and PowerShell is no exception. I have been working with different versions of PowerShell so far, but I'm still far away from understanding the different versions, especially when it comes to Azure.
As far as I understand PowerShell 5 is discontinued, and so is the PowerShell ISE. Following Microsoft's recommendation I switched to the latest version 7 and Visual Studio Code. I have to admit, they work together quite well. (Still I wonder why there is no native support for developing PowerShell in Visual Studio.)
For Azure, there have been the Azure, AzureRM, msol and Az Modules. The latter one is obviously the latest one replacing Azure and AzureRM. As we know, they don't work together, are not up/downwards compatible and at the same time they don't provide the same functionality.
Now I wanted to add a domain to an Azure Active Directory using PowerShell. The only cmdlet I found is New-AzureAdDomain - which does not work in PowerShell 7. After some research I discovered this article which tells me that I cannot use PowerShell 7 but rather should use PowerShell 6 instead:
For the Azure Active Directory PowerShell for Graph module, you must use PowerShell version 5.1 or later. For the Microsoft Azure Active Directory Module for Windows PowerShell module, you must use PowerShell version 5.1 or later up to PowerShell version 6. You cannot use PowerShell version 7.
To me PowerShell versions and its Azure modules just appear to be a rather huge mess. But I assume this might just appear like this due to my lack of understanding how they are actually supposed to work together. I'd appreciate if someone could shed some light on this? Originally, my question should have been something like "How can I add a domain to an AAD using PowerShell 7" but I hope to understand the concept behind it, maybe this enables me to help myself.