{"id":15245,"date":"2017-11-17T09:00:10","date_gmt":"2017-11-17T17:00:10","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/?p=15245"},"modified":"2019-02-14T15:26:47","modified_gmt":"2019-02-14T23:26:47","slug":"managing-secrets-securely-in-the-cloud","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/managing-secrets-securely-in-the-cloud\/","title":{"rendered":"Managing Secrets Securely in the Cloud"},"content":{"rendered":"<p>You\u2019ve probably heard some version of the story about a developer who mistakenly checked in his AWS S3 key to Github. He pulled the key within 5 minutes but still racked up a multi-thousand dollar bill from bots that crawl open source sites looking for secrets. As developers we all understand and care about keeping dev and production secrets safe but managing those secrets on your own or especially in a team can be cumbersome. We are pleased to announce several new features that together will make detecting secrets in code and working with secrets stored securely on Azure easier than it\u2019s ever been before.<\/p>\n<ul>\n<li><a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=chrismann.MicrosoftVisualStudioAsalExtension\">App Services Authentication Extension<\/a> for <a href=\"https:\/\/www.visualstudio.com\/downloads\/\">Visual Studio 2017 version 15.5 or later<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/app-service\/app-service-managed-service-identity\">Managed Service Identity (MSI)<\/a> support in Azure App Services<\/li>\n<li><a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862356\">ASP.NET Key Vault and User Secret Configuration builders Builder<\/a> | <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=852095\">.NET 4.7.1<\/a><\/li>\n<li><a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862355\">Credential Scanner (CredScan) Code Analyzer Preview<\/a><\/li>\n<\/ul>\n<h2>Safeguarding Secrets while building for Azure<\/h2>\n<p>Most of us know it\u2019s a best practice to keep secret settings like connection strings, domain passwords, or other credentials as a runtime configuration and outside the source code. Azure Key Vault provides a security location to safeguard keys and other secrets used by cloud apps. Azure App services recently added support for <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/app-service\/app-service-managed-service-identity\">Managed Service identity<\/a> which means apps running on App Service can easily get authorized to access a Key Vault and other AAD-protected resources so you no longer need to store secrets visibility in environment variables.<\/p>\n<p>If you do this though, getting your local dev environment setup with the right secrets can be a pain, especially if you work in a team. We hear many developers distribute secrets for shared dev services through email or just check them into source code. So we created the <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862354\">App Authentication Extension<\/a> to make it easy to develop apps locally while keeping your secrets in Key Vault. With the extension installed, your locally running app uses the identity signed into Visual Studio to get secrets you are authorized to access directly from Key Vault. This works great in a team environment where you might have security group for the dev team with access to a dev environment Key Vault.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Azure-key-vault.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" title=\"Azure key vault\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2017\/11\/Azure-key-vault.png\" alt=\"Azure key vault\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/Azure-service-authentication-account-selection-setting-in-Tools-Options1.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" title=\"Azure service authentication account selection setting in Tools Options\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2017\/11\/Azure-service-authentication-account-selection-setting-in-Tools-Options1.png\" alt=\"Azure service authentication account selection setting in Tools Options\" \/><\/a><\/p>\n<p>In ASP.NET applications the <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862356\">ASP.NET Key Vault and User Secret configuration builders with .NET 4.7.1<\/a> is a NuGet package that allows secret app settings to be saved in secure configuration stores instead of in web.config as plaintext, without changing application source code. In ASP.NET Core applications there is a small code change, to load Key Vault as a configuration provider and once you do this you are set. This change isn\u2019t done yet, but we\u2019re hoping to eliminate it soon.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/4\/2019\/06\/App-Settings.png\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" title=\"App Settings\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2017\/11\/App-Settings.png\" alt=\"App Settings\" \/><\/a><\/p>\n<p>Here are a couple of walkthroughs that show you how everything works:<\/p>\n<ul>\n<li>ASP.NET: <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862357\">app-service-msi-keyvault-dotnet<\/a><\/li>\n<li>ASP.NET Core: <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862378\">aspnetcore-msi-keyvault<\/a><\/li>\n<\/ul>\n<h2>Credential Scanner (CredScan) Code Analyzer Preview<\/h2>\n<p>We also wanted to make it easier for devs to find secrets in their code to encourage moving secrets to more secure locations like <a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/security\/app-secrets?tabs=visual-studio\">User Secrets<\/a> or <a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/key-vault\/\">Azure Key Vault.<\/a> The <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862355\">Credential Scan Code Analyzer<\/a> is a very early preview that can detect Storage access keys, SAS tokens, API management keys, Cosmos DB access keys, AAD Service principal keys, connection strings for SQL, Azure SQL, Service Bus, Azure Logic apps, BizTalk server, and various other credential types. As you edit your code the analyzer scans your code and immediately warns you about secrets it finds in any open documents with warnings in the error list and in the Build and Code Analysis at Commit time.\u00a0It\u2019s something we\u2019ve been developing, utilizing, and improving within Microsoft for some time now.<\/p>\n<p>The <a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=862355\">Credential Scan Code Analyzer<\/a> is a preview and ships in the experimental DevLabs extension, <a href=\"http:\/\/aka.ms\/cd4vs\">Continuous Delivery Tools for Visual Studio<\/a>. This is because we know this is an important area that goes beyond open documents and can stretch all the way into your CI environment. Rather than waiting, we released an experimental version now because we think it\u2019s useful and we want your feedback on how you would use this in your environment.<\/p>\n<p>Please install these extensions and give the walkthroughs a try to let us know what you think.<\/p>\n<table border=\"0\" width=\"600\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"150\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2017\/11\/Catherine-Wang-e1510874582606.jpg\" width=\"150\" height=\"410\" \/><\/td>\n<td valign=\"top\" width=\"450\"><strong>Catherine Wang<\/strong>, Program Manager, Azure Developer Experience Team\n<a href=\"https:\/\/twitter.com\/cawa_cathy\">@cawa_cathy<\/a>Catherine is a Program Manager for Azure Developer Experience team in Microsoft. I worked on Azure security tooling, Azure diagnostics, Storage Explorer, Service Fabric and Docker tools. Interested in making development experience simple, smooth and productive.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>You\u2019ve probably heard some version of the story about a developer who mistakenly checked in his AWS S3 key to Github. He pulled the key within 5 minutes but still racked up a multi-thousand dollar bill from bots that crawl open source sites looking for secrets. As developers we all understand and care about keeping [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1085,561,1029],"tags":[237,354,85,242,1046,357,156],"class_list":["post-15245","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-open-source","category-web","tag-net","tag-announcement","tag-asp-net","tag-azure","tag-service-fabric","tag-sql","tag-visual-studio-2017"],"acf":[],"blog_post_summary":"<p>You\u2019ve probably heard some version of the story about a developer who mistakenly checked in his AWS S3 key to Github. He pulled the key within 5 minutes but still racked up a multi-thousand dollar bill from bots that crawl open source sites looking for secrets. As developers we all understand and care about keeping [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/15245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=15245"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/15245\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=15245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=15245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=15245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}