azure - PowerShell 版本及其管理 Azure Active Directory 的能力有何区别?

标签 azure powershell azure-active-directory azure-powershell

由于文档极其糟糕,Microsoft 产品给我带来了困难,PowerShell 也不异常(exception)。到目前为止,我一直在使用不同版本的 PowerShell,但距离理解不同版本还很遥远,尤其是在 Azure 方面。

据我了解,PowerShell 5 已停产,PowerShell ISE 也已停产。根据 Microsoft 的建议,我切换到最新版本 7 和 Visual Studio Code。我不得不承认,他们合作得很好。 (我仍然想知道为什么 Visual Studio 中没有对开发 PowerShell 的 native 支持。)

对于 Azure,有 Azure、AzureRM、msol 和 Az 模块。后一种显然是取代 Azure 和 AzureRM 的最新产品。正如我们所知,它们不能一起工作,不能向上/向下兼容,同时它们不提供相同的功能。

现在我想使用 PowerShell 将域添加到 Azure Active Directory。我发现的唯一 cmdlet 是 New-AzureAdDomain - 这在 PowerShell 7 中不起作用。经过一些研究,我发现 this article这告诉我我不能使用 PowerShell 7,而应该使用 PowerShell 6:

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.

对我来说,PowerShell 版本及其 Azure 模块看起来相当困惑。但我认为这可能只是由于我缺乏了解它们实际上应该如何一起工作而出现的。如果有人能解释一下这一点,我将不胜感激?最初,我的问题应该是“如何使用 PowerShell 7 将域添加到 AAD”之类的内容,但我希望了解其背后的概念,也许这使我能够帮助自己。

最佳答案

真是一团糟。首先,不要混淆 WindowsPowershell 和 PowershellCore 版本。

Powershell 1.0 - 5.1 都是 WindowsPowershell,这意味着它们附带 Windows 操作系统,并且只能在 Windows 上运行。

Powershell 6.0+ 是 PowershellCore 版本,它们尚未附带任何操作系统,并且是跨平台的。这两种类型可以在同一台 Windows 计算机上共存,因为它们甚至不使用相同的应用程序 exe 名称。

为什么要把他们分开?好吧,在 Windows 上,您有 .NET Framework,它是一堆用 C# 编写的库,您可以在应用程序中使用它们,因此您不必为所有内容编写代码。然而,.Net Framework 仅适用于 Windows,因此它基本上将 C# 与 Windows 捆绑在一起。微软意识到,为了让 C# 变得更有趣,他们必须使其跨平台,因此他们提出了 Net Core。它是 Net Framework 的跨平台版本。可在 Linux、MacO 和 Windows 上使用。 Powershell 是基于 Net Framework 构建的,因此他们看到了创建跨平台 Powershell 新版本的机会。 所以WindowsPowershell是基于Net Framework的,PowershellCore是基于Net Core的。 微软计划在5.0版本中合并Net Framework和Net Core。不知道他们是否也想合并 Powershell 版本,但他们将其称为 Powershell 7,而不是像版本 6 那样称为 PowershellCore 7。

PowershellCore 的主要问题是其他产品的模块。采取 SCCM、AD 或其他。您可以通过拥有 WindowsServer 并安装这些功能来获取这些模块。或者在客户端计算机上安装 RSAT。大多数这些模块现已在版本 7 中提供。

说到Azure模块,您可以从https://github.com/Azure/azure-powershell/releases/latest下载Azure模块。 您可以使用任一版本的 Powershell。如果您特别需要 AzureAD: https://learn.microsoft.com/en-us/powershell/azure/active-directory/install-adv2?view=azureadps-2.0

您可以在此处阅读有关 Powershell 的更多信息: https://devblogs.microsoft.com/powershell/announcing-PowerShell-7-0/

关于azure - PowerShell 版本及其管理 Azure Active Directory 的能力有何区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63246837/

相关文章:

azure - 如何使用 postman 将图像上传到azure blob存储

node.js - 如何使用 Azure DevOps 管道来运行 LUIS 调度模型的刷新

python - 编码 : utf-8 doesn't seem to work

powershell - 将分钟四舍五入到最接近的 10 分钟

azure - 使用 Python 设置 Azure Active Directory SAML

azure - 获取 Azure Active Directory 中的所有 AppRole 分配

Azure 管道 YAML : Unexpected value 'variables'

c# - KeyVault - 如何从我的 C# 应用程序获取存储在 keyvault 中的 pfx 文件?

powershell - 如何确保使用Powershell启用或禁用Wi-Fi?

oauth - 使用 Azure AD OAuth 进行 Grafana 角色分配