Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Secrets volume not mapped for Worker SDK #223

Open
jbogard opened this issue Dec 16, 2019 · 3 comments
Open

User Secrets volume not mapped for Worker SDK #223

jbogard opened this issue Dec 16, 2019 · 3 comments
Assignees

Comments

@jbogard
Copy link

@jbogard jbogard commented Dec 16, 2019

When you use the Web SDK for Docker, the User Secrets folders are correctly mapped:

https://docs.microsoft.com/en-us/visualstudio/containers/container-build?view=vs-2019#volume-mapping

However, for the Worker SDK, secrets are enabled by default (with a temporary workaround), but the secrets volume is not mapped.

I'm working around this today by mapping myself:

<Project Sdk="Microsoft.NET.Sdk.Worker">

 <PropertyGroup>
   <TargetFramework>netcoreapp3.1</TargetFramework>
   <UserSecretsId>89595f67-a846-41e5-a74e-f876488ea8be</UserSecretsId>
   <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
   <DockerfileRunArguments>-v "$(AppData)/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro"</DockerfileRunArguments>
 </PropertyGroup>

The expected behavior is to be able to use user secrets in a worker SDK whether I'm debugging on the host machine or inside a container.

@pratiksanglikar

This comment has been minimized.

Copy link

@pratiksanglikar pratiksanglikar commented Dec 16, 2019

Thank you for reporting the bug. It is now under investigation.

@pratiksanglikar

This comment has been minimized.

Copy link

@pratiksanglikar pratiksanglikar commented Jan 3, 2020

HI @jbogard ,
I am investigating this issue and just tried to reproduce,

Do user-secrets get loaded by just adding the volume mapping - "$(AppData)/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro"?

  1. Create worker service.
  2. Add user secrets using dotnet user-secrets set "SecretKey" "SecretValue"
  3. Add packageReference to <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.0" />
  4. print user-secret in Worker.cs

Doesn't seem to load user-secrets, is there some step that I am missing?

@pratiksanglikar

This comment has been minimized.

Copy link

@pratiksanglikar pratiksanglikar commented Jan 17, 2020

Create an issue - #2880 since even after mapping the volume, user secrets are not accessible in the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.