how to create a secret in Docker Secret and access it in C# console application? RRS feed

  • Question

  • As I have to hide a salt key from the code, As I have tried with Azure Cloud, but now I am trying with different approaches.

    So, Please help me out .

    Wednesday, March 18, 2020 11:10 AM

All replies

  • Hi Nikita Pandey,
    Based on your description, I have some suggestions you can refer to.
    1.You can use the docker secret create command to add a new secret to the swarm.

    echo "mydatabasepassword" | docker secret create db_pass -

    2.You can use the docker secret ls command to confirm that the secret was added.

    docker secret ls

    3.Giving a service access to the secret by following the command.

    docker service update --secret-add db_pass running_service_name

    4.You can accesse your secret by reading from a file at /run/secrets/mydatabasepassword.
    Best Regards,
    Daniel Zhang

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 19, 2020 7:47 AM