共用方式為


從 Azure Stack Hub 清除入口網站的使用者資料

Azure Stack Hub 操作員可以在 Azure Stack Hub 使用者要求時,按其需求清除入口網站使用者資料。 身為 Azure Stack Hub 使用者,您可以釘選圖格並變更儀表板配置來自訂入口網站。 使用者也可以變更主題,並調整預設語言以符合個人喜好設定。

入口網站的使用者資料包括 Azure Stack Hub 使用者入口網站中的我的最愛和最近存取的資源。 本文會說明如何清除入口網站的使用者資料。

只有在刪除使用者訂用帳戶之後,才能移除入口網站的使用者設定。

注意

在遵循本文中的指導方針之後,事件記錄的 [系統] 區段中仍可能存在部分使用者資料。 此資料可能會保留數天,直到記錄自動變換為止。

必要條件

注意

如果您嘗試對透過來賓目錄 (多重租用) 而獲得邀請的使用者刪除入口網站使用者資訊,您必須擁有該目錄的讀取權限。 如需詳細資訊,請參閱本文稍後的 CSP 案例

使用使用者主體名稱清除入口網站的使用者資料

此案例假設預設提供者訂用帳戶和使用者都屬於相同目錄,或是您擁有使用者所在目錄的讀取權限。

在繼續之前,請務必從 GitHub 下載最新版的 Azure Stack Hub 工具

針對此程序,請使用能夠與 Azure Stack Hub 的系統管理員 Resource Manager 端點通訊的電腦。

  1. 開啟提升權限的 Windows PowerShell 工作階段 (以系統管理員身分執行),移至 [AzureStack-Tools-az] 目錄中的根資料夾,然後匯入必要的 PowerShell 模組:

    Import-Module .\DatacenterIntegration\Portal\PortalUserDataUtilities.psm1
    
  2. 執行下列命令。 請務必將預留位置替換為符合您環境的值:

    ## The following Azure Resource Manager endpoint is for the ASDK. If you are in a multinode environment, contact your operator or service provider to get the endpoint.
    
    $adminARMEndpoint = "https://adminmanagement.local.azurestack.external"
    
    ## Replace the following value with the Azure Stack Hub directory tenant ID.
    $azureStackDirectoryTenantId = "f5025bf2-547f-4b49-9693-6420c1d5e4ca"
    
    ## Replace the following value with the user directory tenant ID.
    $userDirectoryTenantId = " 7ddf3648-9671-47fd-b63d-eecd82ed040e"
    
    ## Replace the following value with name of the user principal whose portal user data is to be cleared.
    $userPrincipalName = "myaccount@contoso.onmicrosoft.com"
    
    Clear-AzsUserDataWithUserPrincipalName -AzsAdminArmEndpoint $adminARMEndpoint `
     -AzsAdminDirectoryTenantId $azureStackDirectoryTenantId `
     -UserPrincipalName $userPrincipalName `
     -DirectoryTenantId $userDirectoryTenantId
    

    注意

    azureStackDirectoryTenantId 是選擇性的。 如果您未指定此值,指令碼會在 Azure Stack Hub 中已註冊的所有租用戶目錄中搜尋使用者主體名稱,然後清除所有相符使用者的入口網站資料。

在來賓目錄中清除入口網站的使用者資料

在此案例中,Azure Stack Hub 操作員沒有使用者所在來賓目錄的存取權。 當您是雲端解決方案提供者 (CSP) 時,這會是常見案例。

若要讓 Azure Stack Hub 操作員能夠移除入口網站的使用者資料,其至少需要有使用者物件識別碼。

使用者必須查詢物件識別碼,並將其提供給 Azure Stack Hub 操作員。 操作員沒有使用者所在目錄的存取權。

使用者擷取使用者物件識別碼

  1. 開啟提升權限的 Windows PowerShell 工作階段 (以系統管理員身分執行),移至 [AzureStack-Tools-az] 目錄中的根資料夾,然後匯入必要的 PowerShell 模組。

    Import-Module .\DatacenterIntegration\Portal\PortalUserDataUtilities.psm1
    
  2. 執行下列命令。 請務必將預留位置替換為符合您環境的值。

    ## The following Azure Resource Manager endpoint is for the ASDK. If you are in a multinode environment, contact your operator or service provider to get the endpoint.
    $userARMEndpoint = "https://management.local.azurestack.external"
    
    ## Replace the following value with the directory tenant ID, which contains the user account.
    $userDirectoryTenantId = "3160cbf5-c227-49dd-8654-86e924c0b72f"
    
    ## Replace the following value with the name of the user principal whose portal user data is to be cleared.
    $userPrincipleName = "myaccount@contoso.onmicrosoft.com"
    
    Get-UserObjectId -DirectoryTenantId $userDirectoryTenantId `
     -AzsArmEndpoint $userARMEndpoint `
     -UserPricinpalName $userPrincipleName
    

    注意

    身為使用者,您必須提供使用者物件識別碼 (也就是上一個指令碼的輸出) 給 Azure Stack Hub 操作員。

Azure Stack Hub 操作員移除入口網站的使用者資料

以 Azure Stack Hub 操作員的身分收到使用者物件識別碼後,請執行下列命令來移除入口網站的使用者資料:

  1. 開啟提升權限的 Windows PowerShell 工作階段 (以系統管理員身分執行),移至 [AzureStack-Tools-az] 目錄中的根資料夾,然後匯入必要的 PowerShell 模組。

    Import-Module .\DatacenterIntegration\Portal\PortalUserDataUtilities.psm1
    
  2. 執行下列命令,並務必要調整參數以符合您的環境:

    ## The following Azure Resource Manager endpoint is for the ASDK. If you are in a multinode environment, contact your operator or service provider to get the endpoint.
    $AzsAdminARMEndpoint = "https://adminmanagement.local.azurestack.external"
    
    ## Replace the following value with the Azure Stack Hub directory tenant ID.
    $AzsAdminDirectoryTenantId = "f5025bf2-547f-4b49-9693-6420c1d5e4ca"
    
    ## Replace the following value with the directory tenant ID of the user to clear.
    $DirectoryTenantId = "3160cbf5-c227-49dd-8654-86e924c0b72f"
    
    ## Replace the following value with the name of the user principal whose portal user data is to be cleared.
    $userObjectID = "s-1-*******"
    Clear-AzsUserDataWithUserObject -AzsAdminArmEndpoint $AzsAdminARMEndpoint `
     -AzsAdminDirectoryTenantId $AzsAdminDirectoryTenantId `
     -DirectoryTenantID $DirectoryTenantId `
     -UserObjectID $userObjectID `
    

後續步驟