%3CLINGO-SUB%20id%3D%22lingo-sub-1975999%22%20slang%3D%22en-US%22%3ENo%20recompile%2C%20no%20redeploy%2C%20managing%20features%20flags%20in%20.NET%20Core%2C%20locally%20and%20with%20Azure%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1975999%22%20slang%3D%22en-US%22%3E%3CHEADER%20id%3D%22main-title%22%20class%3D%22crayons-article__header%22%3E%0A%3CDIV%20class%3D%22crayons-article__header__meta%22%3E%0A%3CDIV%20class%3D%22crayons-article__subheader%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FHEADER%3E%0A%3CDIV%20class%3D%22crayons-article__main%22%3E%0A%3CDIV%20id%3D%22article-body%22%20class%3D%22crayons-article__body%20text-styles%20spec__body%22%20data-article-id%3D%22537958%22%3E%0A%3CP%3EFeature%20flags%20is%20a%20concept%20meaning%20that%20you%20switch%20features%20on%20and%20off%20via%20a%20flag.%20Why%20would%20you%20want%20to%20do%20that%3F%3C%2FP%3E%0A%3CP%3EHere's%20some%20good%20reasons%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EEarly%20integration%3C%2FSTRONG%3E.%20Usually%20you%20work%20on%20a%20feature%20in%20a%20branch.%20The%20longer%20the%20feature%20takes%20to%20complete%2C%20the%20more%20trouble%20you%20will%20have%20with%20merging%2Frebasing%2C%20once%20you%20are%20done%20with%20the%20feature.%20Being%20able%20to%20integrate%20the%20feature%20into%20your%20main%20branch%20early%20means%20less%20of%20that%20kind%20of%20hassle.%20The%20effect%20of%20this%20is%20that%20you%20can%20ship%20a%20feature%20to%20production%20before%20it's%20ready%20for%20public%20use.%20This%20type%20of%20deployment%20is%20also%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Edark%20deployment%3C%2FEM%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EA%2FB%20testing%3C%2FSTRONG%3E.%20A%20known%20pattern%20for%20trying%20out%20new%2C%20or%20changed%20features%2C%20is%20A%2FB%20testing.%20In%20A%2FB%20testing%20you%20want%20to%20answer%20a%20question%2C%20is%20A%20better%20than%20B.%20A%20represents%20one%20version%20of%20your%20app%20and%20B%20the%20other.%20To%20find%20this%20out%2C%20you%20create%20different%20versions%20of%20an%20app.%20Then%20you%20decide%20to%20filter%20your%20incoming%20user%20traffic%20so%20that%20different%20users%20ends%20up%20on%20different%20versions.%20You%20can%20then%20measure%20different%20things%20such%20as%20conversion%20rates%2C%20if%20you%20are%20an%20e-commerce%2C%20or%20maybe%20if%20more%20users%20click%20a%20certain%20button%20and%20more.%20One%20way%20you%20can%20use%20to%20create%20different%20versions%20of%20a%20site%2C%20is%20to%20ensure%20that%20different%20features%20are%20activated.%20On%20a%20website%20this%20can%20mean%20that%20different%20flags%20are%20set%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3ElocalStorage%3C%2FEM%3E%2C%20or%20you%20use%20parameters%20in%20the%20URL%20or%20it's%20decided%20via%20data%20from%20the%20backend.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EFlighting%3C%2FSTRONG%3E.%20Flighting%20is%20a%20term%20that%20means%20that%20a%20certain%20percentage%20of%20users%20gets%20a%20new%20feature.%20It%20can%20be%20almost%20the%20same%20mechanisms%20at%20play%20as%20with%20A%2FB%20testing.%20Instead%20of%20trying%20to%20answer%20whether%20A%20is%20better%20than%20B%2C%20you%20try%20to%20deliver%20a%20new%20feature%20to%20a%20subset%20of%20users%20to%20see%20if%20they%20can%20use%20a%20feature%20without%20issue.%20If%20there's%20an%20issue%2C%20you%20can%20always%20roll%20back.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--1180810637%22%20id%3D%22toc-hId--1180789783%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1306702196%22%20id%3D%22toc-hId-1306723050%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23references%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22references%22%3E%3C%2FA%3EReferences%3C%2FH2%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-app-configuration%2Fconcept-feature-management%3FWT.mc_id%3Ddotnet-11820-chnoring%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWhy%20feature%20management%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-app-configuration%2Fquickstart-feature-flag-aspnet-core%3Ftabs%3Dcore3x%26amp%3BWT.mc_id%3Ddotnet-11820-chnoring%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EUse%20an%20App%20Configuration%20store%20to%20add%20feature%20flags%20to%20ASP%20.NET%20Core%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-gb%2Ffree%2F%3FWT.mc_id%3Ddotnet-11820-chnoring%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EFree%20Azure%20account%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--500752267%22%20id%3D%22toc-hId--500731413%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-1986760566%22%20id%3D%22toc-hId-1986781420%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23using-feature-flags%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22using-feature-flags%22%3E%3C%2FA%3EUsing%20feature%20flags%3C%2FH2%3E%0A%3CP%3EDepending%20on%20if%20you%20are%20working%20on%20a%20mobile%20app%2C%20a%20webapp%20or%20some%20other%20type%20of%20software%2C%20how%20you%20implement%20feature%20flags%20might%20differ.%20The%20flow%20of%20how%20a%20feature%20flag%20is%20applied%20is%20roughly%20the%20same%20though%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3ECreate%20the%20flag%3C%2FSTRONG%3E.%20Create%20the%20flag%20with%20suitable%20name%20and%20namespace%20and%20give%20it%20a%20value.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EEvaluate%20the%20flags%20value%3C%2FSTRONG%3E.%20This%20means%20that%20somewhere%20there's%20a%20line%20of%20code%20looking%20roughly%20like%20so%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20javascript%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22k%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22nx%22%3Eflag%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22c1%22%3E%2F%2F%20render%20A%2C%20else%20B%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3ECode%20like%20that%20might%20be%20baked%20into%20a%20tag%20component%2C%20so%20you%20might%20not%20have%20to%20write%20it.%20(That's%20just%20what%20it%20is%20in%20.NET%20Core)%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSTRONG%3ERender%20different%20experiences%3C%2FSTRONG%3E.%20As%20a%20result%20of%20the%20previous%20bullet%20you%20end%20up%20doing%20something%20differently%2C%20either%20you%20render%2Fdon't%20render%20a%20certain%20portion%20of%20a%20page.%20Or%2C%20you%20redirect%20from%20one%20route%20to%20another%20route%20and%20so%20on.%20The%20exact%20details%20of%20this%20process%20is%20up%20to%20you%2C%20but%20the%20steps%20are%20the%20same.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1617645256%22%20id%3D%22toc-hId--1617624402%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-869867577%22%20id%3D%22toc-hId-869888431%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23no-recompile-no-redeploy%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22no-recompile-no-redeploy%22%3E%3C%2FA%3ENo%20recompile%2C%20No%20redeploy%3C%2FH3%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_1-1607606969150.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239556i8807F08E83912E68%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_1-1607606969150.jpeg%22%20alt%3D%22Chris_Noring_1-1607606969150.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CBLOCKQUOTE%3E%0A%3CP%3EAbove%20is%20Jean%20Claude%20Van%20Damme%20in%20the%20movie%2C%20No%20retreat%2C%20no%20surrender.%20The%20only%20way%20to%20beat%20the%20bad%20guy%20(Van%20Damme)%20was%20by%20a%20superior%20technique%2C%20taught%20to%20a%20young%20fighter%20by%20the%20ghost%20of%20Bruce%20Lee.%20You%20might%20not%20have%20a%20ghost%20handy%2C%20but%20you%20can%20make%20sure%20that%20the%20way%20you%20manage%20your%20feature%20flags%20is%20done%20with%20a%20minimum%20of%20interruption%20-%20No%20recompile%2C%20no%20redeploy.%3C%2FP%3E%0A%3C%2FBLOCKQUOTE%3E%0A%3CP%3EYou%20can%20have%20the%20flag%20as%20a%20variable%20within%20your%20code.%20Depending%20on%20what%20it's%20set%20to%2C%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Efeature%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20either%20on%20or%20off.%20This%20has%20a%20weakness%20though%2C%20it%20forces%20you%20to%20change%20the%20code%2C%20recompile%20and%20redeploy%20it.%20That%20can%20work%20for%20you%20but%20oftentimes%20you%20want%20a%20different%20behavior%2C%20you%20want%20to%20be%20able%20to%20enable%2Fdisable%20flags%20with%20no%20compilation%20or%20redeploy.%20So%20how%20do%20you%20do%20that%3F%20You%20move%20the%20mechanism%20for%20managing%20the%20flags%20outside%20of%20your%20source%20code.%20There's%20a%20couple%20of%20ways%20to%20do%20that%2C%20and%20we%20will%20explore%20both%20ways%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3EConfiguration%20file%3C%2FSTRONG%3E.%20By%20specifying%20the%20flags%20and%20their%20value%20in%20a%20configuration%20file%20and%20have%20your%20app%20read%20from%20said%20file%2C%20you%20accomplish%20a%20decoupling%20of%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eflag%20management%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20app.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3EConfiguration%20service%3C%2FSTRONG%3E.%20A%20configuration%20service%20is%20a%20service%20endpoint%2C%20reachable%20by%20for%20example%20an%20HTTP%20request.%20Such%20a%20service%20can%20be%20placed%20in%20your%20companies%20network%20or%20in%20the%20cloud.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ELet's%20look%20at%20how%20you%20can%20implement%20feature%20flags%20in%20.NET%20Core%20next%2C%20with%20both%20the%20mentioned%20approaches.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-859364473%22%20id%3D%22toc-hId-859385327%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--948089990%22%20id%3D%22toc-hId--948069136%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23example-usage-net-core-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22example-usage-net-core-app%22%3E%3C%2FA%3EExample%20usage%2C%20.NET%20Core%20App%3C%2FH2%3E%0A%3CP%3EIt's%20possible%20to%20work%20with%20feature%20flags%20locally%20by%20using%20a%20built-in%20functionality%20in%20ASP%20.NET%20Core%20that%20uses%20a%20JSON%20file%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.json%3C%2FEM%3E.%20Using%20said%20JSON%20files%20you%20can%20define%20what%20flags%20you%20have%20and%20their%20values.%20Then%20you%20can%20rely%20on%20decorators%20and%20built-in%20tags%20in%20Razor%20to%20display%20differently%20depending%20on%20the%20value%20of%20the%20flags.%3C%2FP%3E%0A%3CP%3EYou'll%20start%20by%20trying%20out%20the%20configuration%20file%20scenario%20first%20and%20then%20move%20to%20use%20the%20App%20Config%20store%20in%20Azure.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--257528516%22%20id%3D%22toc-hId--257507662%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--2064982979%22%20id%3D%22toc-hId--2064962125%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23create-flags-and-configure-your-project-to-use-them%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22create-flags-and-configure-your-project-to-use-them%22%3E%3C%2FA%3ECreate%20flags%20and%20configure%20your%20project%20to%20use%20them%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3ECreate%20an%20ASP%20.NET%20Core%20project%20with%20the%20following%20command%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20new%20mvc%20%3CSPAN%20class%3D%22nt%22%3E--no-https%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22nt%22%3E--output%3C%2FSPAN%3E%20TestFeatureFlags%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EThe%20command%20will%20create%20an%20MVC%20project%20in%20a%20sub%20directory%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ETestFeatureFlags%3C%2FCODE%3E.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ENavigate%20into%20your%20project%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nb%22%3Ecd%20%3C%2FSPAN%3ETestFeatureFlags%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3COL%3E%0A%3CLI%3EAdd%20the%20following%20NuGet%20packages%20with%20the%20following%20command%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20add%20package%20Microsoft.Azure.AppConfiguration.AspNetCore%0A%20%20%20dotnet%20add%20package%20Microsoft.FeatureManagement.AspNetCore%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3COL%3E%0A%3CLI%3ELocate%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EStartup.cs%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20add%20the%20following%20using%20statement%20at%20the%20top%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20csharp%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22k%22%3Eusing%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22nn%22%3EMicrosoft.FeatureManagement%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3COL%3E%0A%3CLI%3EIn%20the%20same%20file%2C%20locate%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EConfigureServices()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%20and%20add%20row%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20csharp%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22n%22%3Eservices%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EAddFeatureManagement%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E()%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3COL%3E%0A%3CLI%3EBy%20default%20.NET%20Core%20reads%20from%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureManagement%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20of%20the%20config%20file%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.jsoon%3C%2FEM%3E.%20You%20can%20override%20that%20my%20specifying%20your%20own%20name%20like%20so%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EConfigureService()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20csharp%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22n%22%3Eservices%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EAddFeatureManagement%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3Eoptions%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22n%22%3Eoptions%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EUseConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3EConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EGetSection%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22MyFeatureFlags%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E))%3B%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D)%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EIt's%20up%20to%20you%20if%20you%20want%20to%20do%20this%20change%20or%20not%2C%20we%20will%20however%20continue%20with%20the%20default%2C%20so%20we%20need%20to%20specify%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureManagement%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsetting.json%3C%2FEM%3E.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsetting.json%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20add%20the%20following%20JSON%20configuration%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20json%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22FeatureManagement%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22FeatureA%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kc%22%3Etrue%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%20%0A%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22Beta%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kc%22%3Etrue%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22FeatureB%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kc%22%3Efalse%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%20%0A%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22FeatureC%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22EnabledFor%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%5B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22Name%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22s2%22%3E%22Percentage%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%2C%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22Parameters%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22Value%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22mi%22%3E50%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%5D%3C%2FSPAN%3E%0A%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EAbove%2C%20you%20introduce%20the%20features%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureA%3C%2FCODE%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EBeta%3C%2FCODE%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureB%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureC%3C%2FCODE%3E.%20Note%20how%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EFeatureC%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20nested.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--272633625%22%20id%3D%22toc-hId--272612771%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--2080088088%22%20id%3D%22toc-hId--2080067234%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23render-the-content%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22render-the-content%22%3E%3C%2FA%3ERender%20the%20content%3C%2FH3%3E%0A%3CP%3ENext%20you%20will%20see%20how%20you%20can%20use%20the%20Razor%20tag%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Efeature%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20render%20a%20portion%20if%20the%20correct%20flag%20is%20enabled.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ELocate%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EIndex.cshtml%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20under%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EViews%2FHome%3C%2FCODE%3E.%20At%20the%20top%20of%20the%20file%20add%20the%20following%20row%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%20%20%20%40addTagHelper%20*%2C%20Microsoft.FeatureManagement.AspNetCore%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EThis%20line%20will%20let%20you%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Efeature%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etag.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EIn%20the%20same%20file%2C%20change%20the%20HTML%20content%20to%20this%20text%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20html%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22text-center%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CH1%20id%3D%22toc-hId-149280161%22%3E%3C%2FH1%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22display-4%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3EWelcome%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CP%3E%3C%2FP%3E%3C%2FSPAN%3ELearn%20about%20%3CSPAN%20class%3D%22nt%22%3E%3CA%3E%3C%2FA%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Ehref%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22https%3A%2F%2Fdocs.microsoft.com%2Faspnet%2Fcore%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3Ebuilding%20Web%20apps%20with%20ASP.NET%20Core%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E.%3CSPAN%20class%3D%22nt%22%3E%3CP%3E%3C%2FP%3E%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CFEATURE%3E%3C%2FFEATURE%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Ename%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Beta%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22nav-item%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CA%3E%3C%2FA%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22nav-link%20text-dark%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-area%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-controller%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Beta%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-action%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Index%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3EBeta%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%0A%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%0A%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%0A%3CP%3ENote%20above%20the%20usage%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Efeature%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etag%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20html%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CFEATURE%3E%3C%2FFEATURE%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Ename%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Beta%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CDIV%3E%3C%2FDIV%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22nav-item%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CA%3E%3C%2FA%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Eclass%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22nav-link%20text-dark%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-area%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-controller%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Beta%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22na%22%3Easp-action%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22Index%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22nt%22%3E%26gt%3B%3C%2FSPAN%3EBeta%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%20%20%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FDIV%3E%0A%20%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%0A%3CP%3EWhat%20you%20are%20saying%20is%2C%20if%20the%20flag%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EBeta%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20set%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etrue%3C%2FCODE%3E%2C%20then%20render%20this%20portion.%20Consulting%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.json%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eyou%20can%20see%20the%20flag%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EBeta%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etrue%3C%2FCODE%3E%2C%20so%20it%20should%20work.%20Let's%20build%20and%20run%20our%20project%20next.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERun%20the%20following%20command%20to%20build%20and%20run%20your%20project%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20build%20%3CSPAN%20class%3D%22o%22%3E%26amp%3B%26amp%3B%3C%2FSPAN%3E%20dotnet%20run%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EYou%20see%20an%20output%20similar%20to%20the%20below%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20plaintext%22%3E%3CCODE%3E%20%20%20info%3A%20Microsoft.Hosting.Lifetime%5B0%5D%0A%20%20%20%20%20%20Now%20listening%20on%3A%20http%3A%2F%2Flocalhost%3A5000%0A%20%20%20info%3A%20Microsoft.Hosting.Lifetime%5B0%5D%0A%20%20%20%20%20%20Application%20started.%20Press%20Ctrl%2BC%20to%20shut%20down.%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3COL%3E%0A%3CLI%3EOpen%20a%20browser%20and%20navigate%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ehttp%3A%2F%2Flocalhost%3A5000%3C%2FCODE%3E.%20You%20should%20see%20the%20following%3A%3C%2FLI%3E%0A%3C%2FOL%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_2-1607606969011.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239557iD73D0D101EDCA7C1%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_2-1607606969011.png%22%20alt%3D%22Chris_Noring_2-1607606969011.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ENext%2C%20open%20up%20your%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsetting.json%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EBeta%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eflag%20to%20false%2C%20like%20so%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20json%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nl%22%3E%22Beta%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22kc%22%3Etrue%3C%2FSPAN%3E%20%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3ESave%20the%20file%20and%20refresh%20the%20browser.%20You%20should%20now%20see%20the%20following%3A%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_3-1607606969008.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239558iDA68F9F1419325E7%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_3-1607606969008.png%22%20alt%3D%22Chris_Noring_3-1607606969008.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECongrats%2C%20you've%20managed%20to%20set%20up%20feature%20flags%20locally%20and%20control%20its%20usage%20via%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsetting.json%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20However%2C%20if%20your%20app%20is%20deployed%20to%20a%20cloud%20service%20like%20Azure%2C%20it's%20somewhat%20impractical%20to%20go%20into%20the%20deployment%20files%2C%20open%20up%20a%20file%20and%20save%20it.%20I%20mean%20you%20can%2C%20but%20it%20feels%20clumsy%2C%20or%20even%20worse%2C%20change%20the%20file%20locally%20and%20redeploy%20the%20whole%20thing%2C%20yikes%20!%3C%2FP%3E%0A%3CP%3EA%20better%20approach%20is%20to%20rely%20on%20a%20configuration%20service.%20For%20Azure%20you%20can%20use%20something%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EAzure%20Config%20Store%3C%2FEM%3E.%20Let's%20leverage%20that%20service%20next.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-278342026%22%20id%3D%22toc-hId--1529091583%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId--1529112437%22%20id%3D%22toc-hId-958421250%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23adding-azure-config-store%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22adding-azure-config-store%22%3E%3C%2FA%3EAdding%20Azure%20Config%20Store%3C%2FH2%3E%0A%3CP%3EBefore%20we%20add%20the%20cloud%20service%20the%20review%20the%20steps%20we%20are%20about%20to%20take%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3ESet%20up%20secrets%20storage%3C%2FSTRONG%3E.%20A%20good%20way%20of%20moving%20configuration%20and%20keys%2C%20during%20development%2C%20is%20to%20use%20the%20secrets%20storage.%20The%20secrets%20storage%20is%20tool%20that%20associates%20keys%20to%20a%20specific%20.NET%20Core%20project.%20Moving%20your%20app%20to%20the%20cloud%20though%2C%20you%20would%20need%20to%20use%20the%20App%20Configuration%20tab%20to%20place%20your%20secrets%20in%20or%20even%20better%2C%20Azure%20Key%20Vault.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3EProvision%20Azure%20Config%20Store%3C%2FSTRONG%3E.%20Provision%20the%20config%20store%20is%20straight%20forward.%20Here%20we%20will%20provision%20the%20store%20and%20add%20a%20feature%20flag%20that%20will%20mirror%20what%20we%20have%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.json%3C%2FEM%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3E%3CSTRONG%3EConfigure%20App%20to%20use%20Config%20Store%3C%2FSTRONG%3E.%20Finally%20we%20will%20configure%20our%20app%20to%20use%20the%20Config%20store.%20That's%20done%20by%20pointing%20out%20the%20connection%20string%20of%20the%20config%20store%20and%20one%20code%20line%20of%20configuring.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH3%20id%3D%22toc-hId-1087483115%22%20id%3D%22toc-hId--719950494%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23set-up-secrets-storage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22set-up-secrets-storage%22%3E%3C%2FA%3ESet%20up%20secrets%20storage%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3ETo%20set%20up%20the%20secrets%20storage%2C%20run%20the%20command%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edotnet%20user-secrets%20init%3C%2FCODE%3E%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20user-secrets%20init%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EYou%20now%20have%20a%20new%20entry%20in%20your%20project%20file%20ending%20with%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3E.csproj%3C%2FEM%3E%2C%20something%20similar%20to%20this%3A%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20xml%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22nt%22%3E%3CUSERSECRETSID%3E%3C%2FUSERSECRETSID%3E%3C%2FSPAN%3E9dcd0c7b-e32d-407d-aabd-d34c644ecaaf%3CSPAN%20class%3D%22nt%22%3E%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EWe%20will%20return%20to%20secrets%20management%20once%20we%20need%20to%20persist%20the%20connection%20string%20from%20our%20cloud%20resource.%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--719971348%22%20id%3D%22toc-hId-1767562339%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-1767541485%22%20id%3D%22toc-hId--39892124%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23provision-azure-config-store%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22provision-azure-config-store%22%3E%3C%2FA%3EProvision%20Azure%20Config%20Store%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3ETo%20provision%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAzure%20Config%20Store%3C%2FCODE%3E%2C%20head%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eportal.azure.com%3C%2FCODE%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%20a%20resource%3C%2FSTRONG%3E%2C%20from%20the%20top%20left%20menu.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESearch%20the%20Marketplace%20box%3C%2FSTRONG%3E%2C%20enter%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EApp%20Configuration%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20select%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EEnter%3C%2FCODE%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20Configuration%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efrom%20the%20search%20results%2C%20and%20then%20select%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EOn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%20App%20Configuration%20pane%3C%2FSTRONG%3E%2C%20enter%20the%20following%20settings%3A%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_4-1607606969014.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239560i1243197CE589A62E%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_4-1607606969014.png%22%20alt%3D%22Chris_Noring_4-1607606969014.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReview%20%2B%20create%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20validate%20your%20settings.%3C%2FLI%3E%0A%3CLI%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--39912978%22%20id%3D%22toc-hId--1847346587%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23get-connection-string%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22get-connection-string%22%3E%3C%2FA%3EGet%20connection%20string%3C%2FH3%3E%0A%3CP%3EOnce%20the%20resource%20has%20finished%20provisioning%2C%20head%20to%20the%20resource%20page.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESettings%20%26gt%3B%20Access%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ekeys.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EMake%20a%20note%20of%20the%20primary%20read-only%20key%20connection%20string.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1847367441%22%20id%3D%22toc-hId-640166246%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23create-a-feature-flag%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22create-a-feature-flag%22%3E%3C%2FA%3ECreate%20a%20feature%20flag%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOperations%20%26gt%3B%20Feature%20manager%20%26gt%3B%20Add%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CP%3EIn%20the%20Add%20pane%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3Echeck%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EEnable%20feature%20flag%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EFor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFeature%20flag%20name%3C%2FSTRONG%3E%2C%20enter%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EBeta%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApply%3C%2FSTRONG%3E%2C%20to%20create%20the%20feature%20flag%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId-640145392%22%20id%3D%22toc-hId--469126276%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23configure-app-to-use-config-store%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22configure-app-to-use-config-store%22%3E%3C%2FA%3EConfigure%20App%20to%20use%20Config%20Store%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3EIn%20a%20terminal%2C%20in%20your%20project%20root%2C%20run%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edotnet%20user-secrets%20set%22%3C%2FCODE%3E%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EEnsure%20you%20replace%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%22%3CYOUR%20connection%3D%22%22%20string%3D%22%22%3E%22%3C%2FYOUR%3E%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewith%20the%20connection%20string%20you%20made%20a%20note%20of%20in%20the%20Azure%20Portal.%3C%2FP%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20user-secrets%20%3CSPAN%20class%3D%22nb%22%3Eset%20%3C%2FSPAN%3EConnectionStrings%3AAppConfig%20%3CSPAN%20class%3D%22s2%22%3E%22%3CYOUR_CONNECTION_STRING%3E%22%3C%2FYOUR_CONNECTION_STRING%3E%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EThis%20will%20set%20a%20secret%20in%20the%20secrets%20manager%20that%20you%20will%20be%20able%20to%20retrieve%20via%20code%20next.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%20the%20file%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EProgram.cs%3C%2FEM%3E%2C%20locate%20the%20method%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ECreateHostBuilder()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20replace%20it%20with%20the%20following%20code%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20csharp%22%3E%3CCODE%3E%20%20%20%3CSPAN%20class%3D%22k%22%3Epublic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22k%22%3Estatic%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3EIHostBuilder%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22nf%22%3ECreateHostBuilder%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22kt%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%5B%5D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3Eargs%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22n%22%3EHost%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3ECreateDefaultBuilder%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3Eargs%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EConfigureWebHostDefaults%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3EwebBuilder%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22n%22%3EwebBuilder%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EConfigureAppConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3Econfig%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kt%22%3Evar%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3Esettings%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3Econfig%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EBuild%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E()%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22kt%22%3Evar%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3Econnection%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22n%22%3Esettings%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EGetConnectionString%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22s%22%3E%22AppConfig%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E)%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22n%22%3Econfig%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EAddAzureAppConfiguration%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3Eoptions%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22p%22%3E%3D%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22n%22%3Eoptions%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EConnect%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3Econnection%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E).%3C%2FSPAN%3E%3CSPAN%20class%3D%22nf%22%3EUseFeatureFlags%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E())%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22p%22%3E%7D).%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3EUseStartup%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%26lt%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22n%22%3EStartup%3C%2FSPAN%3E%3CSPAN%20class%3D%22p%22%3E%26gt%3B())%3B%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EWhat%20you%20did%20was%20calling%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EConfigureAppConfiguration()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Emethod%20on%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EwebBuilder%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einstance.%20It%20takes%20an%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAction%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edelegate%20where%20you%20retrieve%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAppConfig%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Evalue%20from%20the%20section%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EConnectingStrings%3C%2FCODE%3E.%20Then%20you%20use%20the%20result%20string%20value%20and%20call%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAddAzureAppConfiguration()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ethat%20connects%20to%20the%20Config%20store%20and%20instructs%20it%20to%20use%20feature%20flags.%20Next%2C%20let's%20rebuild%20and%20run%20your%20app%20and%20see%20if%20it%20works%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ERun%20the%20app%20with%20this%20terminal%20command%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CDIV%20class%3D%22highlight%20js-code-highlight%22%3E%0A%3CPRE%20class%3D%22highlight%20shell%22%3E%3CCODE%3E%20%20%20dotnet%20build%20%3CSPAN%20class%3D%22o%22%3E%26amp%3B%26amp%3B%3C%2FSPAN%3E%20dotnet%20run%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CDIV%20class%3D%22highlight__panel%20js-actions-panel%22%3E%0A%3CDIV%20class%3D%22highlight__panel-action%20js-fullscreen-code-action%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3EYou%20should%20now%20see%20your%20app%20rendered%20like%20this%3A%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_5-1607606969011.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239559iABB21D6716B225ED%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_5-1607606969011.png%22%20alt%3D%22Chris_Noring_5-1607606969011.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20time%2C%20the%20feature%20flag%20value%20is%20read%20from%20Azure%20instead%20of%20from%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.json%3C%2FEM%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CP%3ELet's%20uncheck%20the%20flag%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EReturn%20back%20to%20the%20Azure%20portal%20and%20the%20App%20Config%20resource%20page%3A%3C%2FLI%3E%0A%3CLI%3ESelect%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOperations%20%26gt%3B%20Feature%20manager%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%3EUncheck%20the%20checkbox%20for%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EBeta%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efeature%20flag.%3C%2FLI%3E%0A%3CLI%3ERestart%20the%20app%20by%20running%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ECtrl-C%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efollowed%20by%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edotnet%20run%3C%2FCODE%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThis%20time%2C%20you%20should%20see%20the%20following%20image%2C%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EBeta%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etext%20gone.%3C%2FP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_6-1607606969009.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239561i1CE152378CC8C7BD%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_6-1607606969009.png%22%20alt%3D%22Chris_Noring_6-1607606969009.png%22%20%2F%3E%3C%2FSPAN%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--598229849%22%20id%3D%22toc-hId-1889303838%22%3E%3CA%20class%3D%22anchor%22%20href%3D%22https%3A%2F%2Fdev.to%2Fazure%2Fno-recompile-no-redeploy-managing-features-flags-in-net-core-locally-and-with-azure-5h84%23summary%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%20name%3D%22summary%22%3E%3C%2FA%3ESummary%3C%2FH2%3E%0A%3CP%3EFirst%20you%20learned%20about%20what%20feature%20flags%20are%20and%20in%20what%20scenarios%20they%20make%20sense%20to%20use.%20Then%20you%20learned%20some%20weird%20movie%20trivia%20about%20Van%20Damme%2C%20sorry%20%3B)%3C%2Fimg%3E%20.%20After%20that%20you%20learned%20how%20to%20set%20up%20feature%20flag%20locally%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Eappsettings.json%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20Finally%2C%20you%20learned%20how%20to%20use%20Azure%20App%20Config%20service%20and%20not%20only%20store%20your%20feature%20flags%20there%20but%20read%20their%20values%20from%20your%20app.%20Hopefully%2C%20this%20got%20you%20more%20interested%20in%20using%20the%20App%20Config%20service%2C%20cause%20there's%20more%20to%20learn%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%0A%3CLINGO-TEASER%20id%3D%22lingo-teaser-1975999%22%20slang%3D%22en-US%22%3E%3CP%3EFeature%20flags%20is%20a%20concept%20meaning%20that%20you%20switch%20features%20on%20and%20off%20via%20a%20flag.%20Why%20would%20you%20want%20to%20do%20that%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere's%20some%20good%20reasons%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EEarly%20integration%3C%2FSTRONG%3E.%20Usually%2C%20you%20work%20on%20a%20feature%20in%20a%20branch.%20The%20longer%20the%20feature%20takes%20to%20complete%2C%20the%20more%20trouble%20you%20will%20have%20with%20merging%2Frebasing%2C%20once%20you%20are%20done%20with%20the%20feature.%20Being%20able%20to%20integrate%20the%20feature%20into%20your%20main%20branch%20early%20means%20less%20of%20that%20kind%20of%20hassle.%20The%20effect%20of%20this%20is%20that%20you%20can%20ship%20a%20feature%20to%20production%20before%20it's%20ready%20for%20public%20use.%20This%20type%20of%20deployment%20is%20also%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3Edark%20deployment%3C%2FEM%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EA%2FB%20testing%3C%2FSTRONG%3E.%20A%20known%20pattern%20for%20trying%20out%20new%2C%20or%20changed%20features%2C%20is%20A%2FB%20testing.%20In%20A%2FB%20testing%20you%20want%20to%20answer%20a%20question%2C%20is%20A%20better%20than%20B.%20A%20represents%20one%20version%20of%20your%20app%20and%20B%20the%20other.%20To%20find%20this%20out%2C%20you%20create%20different%20versions%20of%20an%20app.%20Then%20you%20decide%20to%20filter%20your%20incoming%20user%20traffic%20so%20that%20different%20users%20ends%20up%20on%20different%20versions.%20You%20can%20then%20measure%20different%20things%20such%20as%20conversion%20rates%2C%20if%20you%20are%20an%20e-commerce%2C%20or%20maybe%20if%20more%20users%20click%20a%20certain%20button%20and%20more.%20One%20way%20you%20can%20use%20to%20create%20different%20versions%20of%20a%20site%2C%20is%20to%20ensure%20that%20different%20features%20are%20activated.%20On%20a%20website%20this%20can%20mean%20that%20different%20flags%20are%20set%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3ElocalStorage%3C%2FEM%3E%2C%20or%20you%20use%20parameters%20in%20the%20URL%20or%20it's%20decided%20via%20data%20from%20the%20backend.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EFlighting%3C%2FSTRONG%3E.%20Flighting%20is%20a%20term%20that%20means%20that%20a%20certain%20percentage%20of%20users%20gets%20a%20new%20feature.%20It%20can%20be%20almost%20the%20same%20mechanisms%20at%20play%20as%20with%20A%2FB%20testing.%20Instead%20of%20trying%20to%20answer%20whether%20A%20is%20better%20than%20B%2C%20you%20try%20to%20deliver%20a%20new%20feature%20to%20a%20subset%20of%20users%20to%20see%20if%20they%20can%20use%20a%20feature%20without%20issue.%20If%20there's%20an%20issue%2C%20you%20can%20always%20roll%20back.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Chris_Noring_1-1607606969150.jpeg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F239556i8807F08E83912E68%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Chris_Noring_1-1607606969150.jpeg%22%20alt%3D%22Chris_Noring_1-1607606969150.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1975999%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWeb%20Apps%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
 

Feature flags is a concept meaning that you switch features on and off via a flag. Why would you want to do that?

Here's some good reasons:

  • Early integration. Usually you work on a feature in a branch. The longer the feature takes to complete, the more trouble you will have with merging/rebasing, once you are done with the feature. Being able to integrate the feature into your main branch early means less of that kind of hassle. The effect of this is that you can ship a feature to production before it's ready for public use. This type of deployment is also called dark deployment.
  • A/B testing. A known pattern for trying out new, or changed features, is A/B testing. In A/B testing you want to answer a question, is A better than B. A represents one version of your app and B the other. To find this out, you create different versions of an app. Then you decide to filter your incoming user traffic so that different users ends up on different versions. You can then measure different things such as conversion rates, if you are an e-commerce, or maybe if more users click a certain button and more. One way you can use to create different versions of a site, is to ensure that different features are activated. On a website this can mean that different flags are set in localStorage, or you use parameters in the URL or it's decided via data from the backend.
  • Flighting. Flighting is a term that means that a certain percentage of users gets a new feature. It can be almost the same mechanisms at play as with A/B testing. Instead of trying to answer whether A is better than B, you try to deliver a new feature to a subset of users to see if they can use a feature without issue. If there's an issue, you can always roll back.

 

References

 

Using feature flags

Depending on if you are working on a mobile app, a webapp or some other type of software, how you implement feature flags might differ. The flow of how a feature flag is applied is roughly the same though:

  1. Create the flag. Create the flag with suitable name and namespace and give it a value.
  2. Evaluate the flags value. This means that somewhere there's a line of code looking roughly like so:
   if (flag) {
      // render A, else B
   }
 

Code like that might be baked into a tag component, so you might not have to write it. (That's just what it is in .NET Core)

  1. Render different experiences. As a result of the previous bullet you end up doing something differently, either you render/don't render a certain portion of a page. Or, you redirect from one route to another route and so on. The exact details of this process is up to you, but the steps are the same.

 

No recompile, No redeploy

Chris_Noring_1-1607606969150.jpeg

 

Above is Jean Claude Van Damme in the movie, No retreat, no surrender. The only way to beat the bad guy (Van Damme) was by a superior technique, taught to a young fighter by the ghost of Bruce Lee. You might not have a ghost handy, but you can make sure that the way you manage your feature flags is done with a minimum of interruption - No recompile, no redeploy.

You can have the flag as a variable within your code. Depending on what it's set to, the feature is either on or off. This has a weakness though, it forces you to change the code, recompile and redeploy it. That can work for you but oftentimes you want a different behavior, you want to be able to enable/disable flags with no compilation or redeploy. So how do you do that? You move the mechanism for managing the flags outside of your source code. There's a couple of ways to do that, and we will explore both ways:

  • Configuration file. By specifying the flags and their value in a configuration file and have your app read from said file, you accomplish a decoupling of flag management and app.

  • Configuration service. A configuration service is a service endpoint, reachable by for example an HTTP request. Such a service can be placed in your companies network or in the cloud.

Let's look at how you can implement feature flags in .NET Core next, with both the mentioned approaches.

 

Example usage, .NET Core App

It's possible to work with feature flags locally by using a built-in functionality in ASP .NET Core that uses a JSON file appsettings.json. Using said JSON files you can define what flags you have and their values. Then you can rely on decorators and built-in tags in Razor to display differently depending on the value of the flags.

You'll start by trying out the configuration file scenario first and then move to use the App Config store in Azure.

 

Create flags and configure your project to use them

  1. Create an ASP .NET Core project with the following command:
   dotnet new mvc --no-https --output TestFeatureFlags
 

The command will create an MVC project in a sub directory TestFeatureFlags.

  1. Navigate into your project:
   cd TestFeatureFlags
 
  1. Add the following NuGet packages with the following command:
   dotnet add package Microsoft.Azure.AppConfiguration.AspNetCore
   dotnet add package Microsoft.FeatureManagement.AspNetCore
 
  1. Locate Startup.cs and add the following using statement at the top:
   using Microsoft.FeatureManagement;
 
  1. In the same file, locate ConfigureServices() method and add row:
   services.AddFeatureManagement();
 
  1. By default .NET Core reads from a FeatureManagement section of the config file appsettings.jsoon. You can override that my specifying your own name like so in ConfigureService() method:
   services.AddFeatureManagement(options =>
   {
      options.UseConfiguration(Configuration.GetSection("MyFeatureFlags"));
   });
 

It's up to you if you want to do this change or not, we will however continue with the default, so we need to specify a FeatureManagement section in appsetting.json.

  1. Open appsetting.json and add the following JSON configuration:
   "FeatureManagement": {
     "FeatureA": true, 
     "Beta": true,
     "FeatureB": false, 
     "FeatureC": {
        "EnabledFor": [
            {
                "Name": "Percentage",
                "Parameters": {
                    "Value": 50
                }
            }
        ]
     }
   }
 

Above, you introduce the features FeatureA, Beta, FeatureB and FeatureC. Note how FeatureC is nested.

 

Render the content

Next you will see how you can use the Razor tag feature and render a portion if the correct flag is enabled.

  1. Locate the Index.cshtml file under Views/Home. At the top of the file add the following row:
   @addTagHelper *, Microsoft.FeatureManagement.AspNetCore
 

This line will let you use the feature tag.

  1. In the same file, change the HTML content to this text:
   <div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
    <feature name="Beta">
      <div class="nav-item">
        <a class="nav-link text-dark" asp-area="" asp-controller="Beta" asp-action="Index">Beta</a>
      </div>
    </feature>
   </div>
 

Note above the usage of the feature tag:

   <feature name="Beta">
      <div class="nav-item">
        <a class="nav-link text-dark" asp-area="" asp-controller="Beta" asp-action="Index">Beta</a>
      </div>
    </feature>
 

What you are saying is, if the flag Beta is set to true, then render this portion. Consulting your appsettings.json you can see the flag Beta is true, so it should work. Let's build and run our project next.

  1. Run the following command to build and run your project:
   dotnet build && dotnet run
 

You see an output similar to the below:

   info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
   info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
 
  1. Open a browser and navigate to http://localhost:5000. You should see the following:
Chris_Noring_2-1607606969011.png

 

  1. Next, open up your appsetting.json and set the Beta flag to false, like so:
   "Beta": true 
 

Save the file and refresh the browser. You should now see the following:

Chris_Noring_3-1607606969008.png

 

Congrats, you've managed to set up feature flags locally and control its usage via appsetting.json file. However, if your app is deployed to a cloud service like Azure, it's somewhat impractical to go into the deployment files, open up a file and save it. I mean you can, but it feels clumsy, or even worse, change the file locally and redeploy the whole thing, yikes !

A better approach is to rely on a configuration service. For Azure you can use something called Azure Config Store. Let's leverage that service next.

 

Adding Azure Config Store

Before we add the cloud service the review the steps we are about to take:

  • Set up secrets storage. A good way of moving configuration and keys, during development, is to use the secrets storage. The secrets storage is tool that associates keys to a specific .NET Core project. Moving your app to the cloud though, you would need to use the App Configuration tab to place your secrets in or even better, Azure Key Vault.

  • Provision Azure Config Store. Provision the config store is straight forward. Here we will provision the store and add a feature flag that will mirror what we have in the appsettings.json.

  • Configure App to use Config Store. Finally we will configure our app to use the Config store. That's done by pointing out the connection string of the config store and one code line of configuring.

Set up secrets storage

  1. To set up the secrets storage, run the command dotnet user-secrets init:
   dotnet user-secrets init
 

You now have a new entry in your project file ending with .csproj, something similar to this:

   <UserSecretsId>9dcd0c7b-e32d-407d-aabd-d34c644ecaaf</UserSecretsId>
 

We will return to secrets management once we need to persist the connection string from our cloud resource.

 

Provision Azure Config Store

  1. To provision an Azure Config Store, head to portal.azure.com.

  2. Select Create a resource, from the top left menu.

  3. In the Search the Marketplace box, enter App Configuration and select Enter.

  4. Select App Configuration from the search results, and then select Create.

  5. On the Create App Configuration pane, enter the following settings:

Chris_Noring_4-1607606969014.png

 

  1. Select Review + create to validate your settings.
  2. Select Create

Get connection string

Once the resource has finished provisioning, head to the resource page.

  1. Select Settings > Access keys.

  2. Make a note of the primary read-only key connection string.

Create a feature flag

  1. Select Operations > Feature manager > Add.

  2. In the Add pane:

    1. check Enable feature flag
    2. For Feature flag name, enter Beta
    3. Select Apply, to create the feature flag

Configure App to use Config Store

  1. In a terminal, in your project root, run dotnet user-secrets set":

Ensure you replace "<your connection string>" with the connection string you made a note of in the Azure Portal.

   dotnet user-secrets set ConnectionStrings:AppConfig "<your_connection_string>"
 

This will set a secret in the secrets manager that you will be able to retrieve via code next.

  1. Open the file Program.cs, locate the method CreateHostBuilder() and replace it with the following code:
   public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
            webBuilder.ConfigureAppConfiguration(config =>
            {
                var settings = config.Build();
                var connection = settings.GetConnectionString("AppConfig");
                config.AddAzureAppConfiguration(options =>
                    options.Connect(connection).UseFeatureFlags());
            }).UseStartup<Startup>());
 

What you did was calling the ConfigureAppConfiguration() method on the webBuilder instance. It takes an Action delegate where you retrieve the AppConfig value from the section ConnectingStrings. Then you use the result string value and call AddAzureAppConfiguration() that connects to the Config store and instructs it to use feature flags. Next, let's rebuild and run your app and see if it works :)

  1. Run the app with this terminal command:
   dotnet build && dotnet run
 

You should now see your app rendered like this:

Chris_Noring_5-1607606969011.png

 

This time, the feature flag value is read from Azure instead of from appsettings.json

  1. Let's uncheck the flag:

    1. Return back to the Azure portal and the App Config resource page:
    2. Select Operations > Feature manager
    3. Uncheck the checkbox for the Beta feature flag.
    4. Restart the app by running Ctrl-C followed by dotnet run.

This time, you should see the following image, with the Beta text gone.

Chris_Noring_6-1607606969009.png

 

Summary

First you learned about what feature flags are and in what scenarios they make sense to use. Then you learned some weird movie trivia about Van Damme, sorry ;) . After that you learned how to set up feature flag locally using the appsettings.json file. Finally, you learned how to use Azure App Config service and not only store your feature flags there but read their values from your app. Hopefully, this got you more interested in using the App Config service, cause there's more to learn :)