How to find an AWS AppStream 2.0 users homedrive path
Scenario
AWS AppStream 2.0 generates a SHA-256 hash of the users NameID for their Home Drive – when using SAML (aka Federated) authentication. This can potentially make it difficult to find the users home share if browsing from AWS S3 or for support teams when supporting users or uploading documents to the users ‘home drive’.
Example
In this document is an example of a federated users home drive autocreated in S3 after the user has accessed AppStream 2.0 for the first time.
This script will simply create a function in Windows powershell and allow you to generate the SHA256 hash based on the NameID and so you can discover the users homepath.
Function Get-StringHash([String] $String,$HashName = "MD5") { $StringBuilder = New-Object System.Text.StringBuilder [System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))|%{ [Void]$StringBuilder.Append($_.ToString("x2")) } $StringBuilder.ToString() } $myvar = Read-Host –Prompt 'Enter string to hash' Get-StringHash $myvar "SHA256"
Result
As we know the users NameID being passed into the AppStream session (in this instance its actually my email address)