首页 > 解决方案 > 有没有办法使用 PowerShell 将 Windows 10 计算机加入 Azure AD?

问题描述

我想使用 PowerShell 脚本将组织中的计算机加入 Azure AD。

我尝试使用New-AzureADDevice命令

但在示例中:

New-AzureADDevice -AccountEnabled $true -DisplayName "My new device" -AlternativeSecurityIds $altsecid -DeviceId $guid -DeviceOSType "OS/2" -DeviceOSVersion "9.3"

有人可以解释参数AlternativeSecurityIds的来源吗?

标签: azurepowershellazure-active-directorywindows-10

解决方案


AlternativeSecurityId 由三个元素组成,设备只需要两个元素。

参考:https ://docs.microsoft.com/en-us/graph/api/resources/alternativesecurityid?view=graph-rest-1.0

AlternativeSecurityIds        : {class AlternativeSecurityId {
                                  IdentityProvider:
                                  Key: System.Byte[]
                                  Type: 2
                                }
                                }
  • 密钥本身是此处描述的类型

    X509:[指纹]+[公钥哈希]

  • 类型确定密钥的用途(例如 Bitlocker、Windows Hello、Recoverykeys)

         $key = [System.Text.Encoding]::Unicode.GetBytes("X509:<SHA1-TP-PUBKEY><Thumbprint>")
         $altsecids = New-Object -TypeName PSObject -Property @{
    
         #'IdentityProvider' = 'null'
         'Key' = $key
         'Type' = "2" }
    
    
    
    
         New-AzureADDevice -AccountEnabled $true -DisplayName '<NAME>' -DeviceOSType 'OS/2' -DeviceOSVersion '9.3' -AlternativeSecurityIds $altsecids -DeviceId (New-Guid)
    

这主要用于内部使用,我的理解是您将无法满足您的要求。

在此处输入图像描述

目前,没有可以自动加入 AAD 的 powershell 脚本/命令

已经有相同的现有用户语音

另一个选项将能够利用:


推荐阅读