Appstream Elastic Fleet set Environment Variables in Windows

0

I have an application set up as an Elastic Fleet in AppStream2. I want to set up some environment variables for that application on a per user basis, ideally associated with a user from the User Pool, and not associated with a directory account.

The environment variables will contain connection string settings for a database, as well as a user id for the application.

Is this possible?

질문됨 2년 전846회 조회
1개 답변
0

Setting Windows environment variables is pretty straightforward - you can write a script that calls Windows commands to set them (SET/SETX for batch/cmd, $env or [System.Environment]::SetEnvironmentVariable for Powershell).

What's a bit more complicated is getting the value to be set to that environment variable. When using the CreateStreamingURL API or SAML2.0 federation, you can use the SessionContext parameter to pass information into the streaming instance which AppStream 2.0 then sets as the AppStream_Session_Context environment variable. User Pools does not support this capability, and isn't recommended for use beyond proof of concepts - it's not meant to be an identity provider. Instead, the recommendation is to integrate your existing identity provider to eliminate the need of managing users/passwords within AppStream 2.0

For all authentication modes, AppStream 2.0 also creates the fleet and instance metadata environment variables which you can use on your scripts to get information about the user and the fleet. One way to manage a per-user connection string would be to have a lookup (perhaps through a Lambda function) based the username that's streaming, and return the connection string for them, to be set as the Windows environment variable. Alternatively, if you only have a handful of users, and the information isn't sensitive (eg: no issue if other users see it), store and set the values using a session script that executes before the user session starts.

Hope this helps.

전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠