%3CLINGO-SUB%20id%3D%22lingo-sub-1800612%22%20slang%3D%22en-US%22%3EManaging%20and%20Rotating%20Secrets%20with%20Azure%20KeyVault%2C%20Managed%20Services%2C%20and%20some%20automation%20%E2%80%93%20Part%201%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1800612%22%20slang%3D%22en-US%22%3E%3CP%3EMany%20organizations%20have%20long%20standing%20security%20mandates%20to%20rotate%20application%20secrets.%20These%20secrets%20can%20range%20from%20specific%20identify%20passwords%20to%20service%20access%20keys.%20As%20more%20enterprises%20move%20their%20workloads%20to%20the%20cloud%2C%20the%20need%20for%20adherence%20to%20these%20policies%20becomes%20more%20apparent.%20More%20and%20more%20workloads%20take%20advantage%20of%20a%20multitude%20of%20PaaS%20services%2C%20many%20of%20which%20utilize%20different%20access%20control%20schemes.%20As%20the%20number%20of%20such%20services%20and%20custom%20applications%20that%20rely%20on%20them%20grows%2C%20IT%20administrators%20are%20often%20left%20to%20their%20own%20devices%20to%20figure%20out%20how%20to%20manage%20periodic%20rotation%20of%20the%20multitude%20of%20secrets%20as%20well%20as%20how%20to%20update%20their%20dependent%20applications%20when%20such%20change%20is%20made.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAzure%20offers%20some%20automation%20to%20help%20solve%20a%20portion%20of%20these%20problems%2C%20specifically%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkey-vault%2Fsecrets%2Foverview-storage-keys%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eautomated%20storage%20account%20rotation%20by%20Key%20Vault%3C%2FA%3E%20and%20general%20guidance%20on%20how%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkey-vault%2Fsecrets%2Ftutorial-rotation-dual%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eautomation%20to%20solve%20these%20types%20of%20problems%3C%2FA%3E%20for%20other%20services.%20Unfortunately%2C%20this%20is%20often%20not%20enough%20to%20ease%20the%20tasks%20associated%20with%20managing%20this%20problem%20space.%20Not%20only%20are%20these%20solutions%20insufficient%20in%20addressing%20a%20multitude%20of%20services%20organizations%20use%20in%20the%20cloud%2C%20they%20also%20do%20not%20address%20the%20%E2%80%9Cupdate%20dependent%20applications%E2%80%9D%20part%20of%20the%20problem%20at%20all.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHaving%20worked%20with%20multiple%20Azure%20customers%20who%20have%20faced%20these%20challenges%2C%20I%20decided%20to%20address%20this%20whitespace%20by%20building%20a%20solution%20to%20tackle%20this%20specific%20area.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20am%20not%20that%20creative%20when%20it%20comes%20to%20naming%20things%2C%20so%20after%20a%20short%20deliberation%20period%20I%20went%20with%20my%20go%20to%20approach%20for%20naming%20projects%20%E2%80%93%20Greek%20%2F%20Roman%20Mythologies.%20And%20that%20is%20how%20project%20%E2%80%9C%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHarpocrates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHarpocrates%3C%2FA%3E%E2%80%9D%20was%20born.%20I%20have%20many%20ideas%20on%20how%20this%20solution%20could%20be%20distributed%20in%20the%20future%2C%20but%20for%20now%2C%20its%20source%20code%20is%20available%20on%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fgkli%2Fharpocrates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGitHub%3C%2FA%3E.%20At%20the%20time%20of%20this%20writing%2C%20the%20codebase%20is%20in%20a%20rather%20early%20stage.%20The%20solution%20works%20and%20can%20rotate%20secrets%20for%20several%20different%20services.%20The%20code%2C%20however%2C%20can%20stand%20some%20refactoring%20and%20additional%20features%2C%20which%20I%20plan%20on%20working%20on%20over%20time.%20So%20for%20all%20intensive%20purposes%2C%20this%20should%20be%20treated%20as%20work%20in%20progress.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAt%20the%20root%20of%20the%20problem%20Harpocrates%20addresses%20is%20a%20relatively%20simple%20business%20process%20depicted%20below.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorGaryKli_0%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bpm1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228075i9811AB6F030A92F9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22bpm1.png%22%20alt%3D%22bpm1.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EFigure%201%20Secret%20Rotation%20Business%20Process%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIncorporating%20this%20business%20process%20with%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fkey-vault%2Fsecrets%2Ftutorial-rotation-dual%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eguidance%20given%20by%20Azure%3C%2FA%3E%20one%20can%20utilize%20the%20following%20high%20level%20flow%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bpm2.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228076i6715C6CCDBEA3864%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22bpm2.png%22%20alt%3D%22bpm2.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EFigure%202%20Harpocrates%20Logical%20Flow%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUsing%20the%20two%20diagrams%20depicted%20as%20the%20basic%20premise%20for%20Harpocartes%20we%20have%20an%20application%20that%20can%20monitor%20events%20raised%20out%20of%20Key%20Vault.%20At%20the%20time%20of%20writing%2C%20Harpocrates%20can%20act%20on%203%20specific%20events%3A%20%E2%80%9CSecret%20Expired%E2%80%9D%2C%20%E2%80%9CSecret%20Expiring%E2%80%9D%2C%20and%20%E2%80%9CSecret%20Created%E2%80%9D.%20In%20future%2C%20there%20is%20a%20desire%20to%20add%20management%20of%20KV%20Keys%20%26amp%3B%20Certificate%20objects%20as%20well.%20Harpocrates%20is%20specifically%20built%20to%20automate%20the%20following%20logical%20flow.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorGaryKli_2%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bpm3.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228080iA92A23B1D4269379%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22bpm3.png%22%20alt%3D%22bpm3.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EFigure%203%20Harpocrates%20Business%20Process%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20allow%20for%20extensibility%2C%20specifically%20around%20solution%E2%80%99s%20ability%20to%20manage%20a%20multitude%20of%20downstream%20services%2C%20including%20those%20hosted%20in%20other%20clouds%20as%20well%20as%20custom%20applications%2C%20Harpocrates%20takes%20a%20factory-based%20approach%20to%20interactions%20with%20these%20services%E2%80%99%20management%20endpoints.%20Thera%20are%20concrete%20implementations%20for%20management%20of%20Azure%20Storage%20Accounts%2C%20Azure%20CosmosDB%2C%20Azure%20Application%20Registration%20(Service%20Principals)%2C%20etc.%20These%20constructs%20can%20be%20easily%20extended%20to%20add%20%E2%80%9CSecret%20Management%20Providers%E2%80%9D%20for%20AWS%20S3%20buckets%20or%20your%20custom%20application.%20The%20only%20assumption%20Harpocrates%20makes%20is%20that%20the%20downstream%20services%20management%20endpoints%20are%20available%20for%20its%20consumption.%20This%20means%20the%20management%20endpoint%20needs%20to%20be%20addressable%20on%20the%20network%20and%20Harpocrates%20will%20have%20permissions%20to%20invoke%20the%20relevant%20functionality.%20For%20the%20purpose%20of%20this%20solution%2C%20the%20term%20%E2%80%9Cmanagement%20endpoint%E2%80%9D%20is%20being%20used%20loosely%20to%20represent%20an%20entity%20the%20application%20can%20interact%20with%20to%20manage%20the%20service%20secrets.%20This%20can%20be%20a%20restful%20endpoint%2C%20a%20custom%20API%2C%20or%20simply%20a%20file%20path%20where%20config%20files%20are%20stored%2C%20thus%20allowing%20for%20a%20high%20degree%20of%20extensibility.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHarpocrates%20is%20also%20being%20designed%20to%20support%20deployments%20into%20various%20compute%20platforms%20such%20as%20AKS%2C%20App%20Service%2C%20VM%2C%20or%20even%20ACI%20or%20Azure%20Functions%2C%20as%20well%20as%20support%20a%20number%20of%20different%20storage%20technologies%20as%20to%20not%20place%20a%20significant%20burden%20on%20deploying%20the%20solution%20into%20your%20own%20environment.%20Depicted%20below%20are%20high%20level%20deployment%20diagrams%20of%20Harpocrates%20in%20AKS%20and%20App%20Service.%20These%20are%20just%20examples%20as%20the%20solution%20can%20be%20deployed%20into%20serverless%20environments%20as%20well.%20I%20plan%20on%20having%20an%20article%20in%20this%20blog%20series%20dedicated%20to%20specific%20deployment%20scenarios.%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorGaryKli_3%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22deploy-k8.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228081i830793C52DC782B8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22deploy-k8.png%22%20alt%3D%22deploy-k8.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EFigure%204%20Harpocrates%20Azure%20Kubernetes%20Service%20Deployment%20Diagram%3C%2FP%3E%0A%3CDIV%20id%3D%22tinyMceEditorGaryKli_4%22%20class%3D%22mceNonEditable%20lia-copypaste-placeholder%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22deploy-appservice.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F228083i2B23722ADDE26F53%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22deploy-appservice.png%22%20alt%3D%22deploy-appservice.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3EFigure%205%20%26nbsp%3BHarpocrates%20Azure%20AppService%20Deployment%20Diagram%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%E2%80%99re%20still%20reading%20this%20and%20are%20interested%20in%20learning%20more%20about%20Harpocrates%20and%20its%20journey%20to%20addressing%20this%20problem%20space%2C%20please%20take%20a%20look%20at%20other%20articles%20in%20this%20blog%20series%20and%20as%20always%2C%20feel%20free%20to%20browse%20the%20codebase%20and%20provide%20feedback.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1800612%22%20slang%3D%22en-US%22%3E%3CP%3ESecret%20rotation%20is%20not%20a%20new%20problem.%20In%20cloud-based%20environments%20many%20services%20implement%20secret-based%20authentication%20schemes.%20For%20many%20organizations%2C%20these%20secrets%20must%20be%20rotated%20on%20a%20regular%20schedule.%20In%20addition%20to%20the%20actual%20problem%20of%20rotating%20the%20access%20keys%2C%20there%20exists%20a%20problem%20of%20how%20these%20newly%20rotated%20credentials%20are%20propagated%20to%20all%20the%20applications%20and%20systems%20that%20utilize%20them.%20In%20this%20multi-part%20blog%20series%2C%20I%20will%20discuss%20a%20solution%20that%2C%20through%20automation%2C%20addresses%20both%20the%20scheduled%20rotation%20and%20dependency%20notification%2Fupdate%20requirements.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1800612%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApplication%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAutomation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKey%20Rotation%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKeyVault%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESecurity%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1819509%22%20slang%3D%22en-US%22%3ERe%3A%20Managing%20and%20Rotating%20Secrets%20with%20Azure%20Key%20Vault%2C%20Managed%20Services%2C%20and%20some%20automation%20%E2%80%93%20Part%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1819509%22%20slang%3D%22en-US%22%3E%3CP%3EPart%202%20of%20this%20blog%20series%20is%20now%20available%20here%3A%26nbsp%3B%3CA%20title%3D%22Managing%20and%20Rotating%20Secrets%20with%20Azure%20Key%20Vault%2C%20Managed%20Services%2C%20and%20some%20automation%20%E2%80%93%20Part%202%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-architecture-blog%2Fmanaging-and-rotating-secrets-with-azure-key-vault-managed%2Fba-p%2F1819490%22%20target%3D%22_self%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-architecture-blog%2Fmanaging-and-rotating-secrets-with-azure-key-vault-managed%2Fba-p%2F1819490%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Many organizations have long standing security mandates to rotate application secrets. These secrets can range from specific identify passwords to service access keys. As more enterprises move their workloads to the cloud, the need for adherence to these policies becomes more apparent. More and more workloads take advantage of a multitude of PaaS services, many of which utilize different access control schemes. As the number of such services and custom applications that rely on them grows, IT administrators are often left to their own devices to figure out how to manage periodic rotation of the multitude of secrets as well as how to update their dependent applications when such change is made.

 

Azure offers some automation to help solve a portion of these problems, specifically automated storage account rotation by Key Vault and general guidance on how to use automation to solve these types of problems for other services. Unfortunately, this is often not enough to ease the tasks associated with managing this problem space. Not only are these solutions insufficient in addressing a multitude of services organizations use in the cloud, they also do not address the “update dependent applications” part of the problem at all.

 

Having worked with multiple Azure customers who have faced these challenges, I decided to address this whitespace by building a solution to tackle this specific area.

 

I am not that creative when it comes to naming things, so after a short deliberation period I went with my go to approach for naming projects – Greek / Roman Mythologies. And that is how project “Harpocrates” was born. I have many ideas on how this solution could be distributed in the future, but for now, its source code is available on GitHub. At the time of this writing, the codebase is in a rather early stage. The solution works and can rotate secrets for several different services. The code, however, can stand some refactoring and additional features, which I plan on working on over time. So for all intensive purposes, this should be treated as work in progress.

 

At the root of the problem Harpocrates addresses is a relatively simple business process depicted below.

 

bpm1.png
Figure 1 Secret Rotation Business Process

 

Incorporating this business process with the guidance given by Azure one can utilize the following high level flow

 

bpm2.png
Figure 2 Harpocrates Logical Flow

 

Using the two diagrams depicted as the basic premise for Harpocartes we have an application that can monitor events raised out of Key Vault. At the time of writing, Harpocrates can act on 3 specific events: “Secret Expired”, “Secret Expiring”, and “Secret Created”. In future, there is a desire to add management of KV Keys & Certificate objects as well. Harpocrates is specifically built to automate the following logical flow.

 

bpm3.png
Figure 3 Harpocrates Business Process

 

To allow for extensibility, specifically around solution’s ability to manage a multitude of downstream services, including those hosted in other clouds as well as custom applications, Harpocrates takes a factory-based approach to interactions with these services’ management endpoints. Thera are concrete implementations for management of Azure Storage Accounts, Azure CosmosDB, Azure Application Registration (Service Principals), etc. These constructs can be easily extended to add “Secret Management Providers” for AWS S3 buckets or your custom application. The only assumption Harpocrates makes is that the downstream services management endpoints are available for its consumption. This means the management endpoint needs to be addressable on the network and Harpocrates will have permissions to invoke the relevant functionality. For the purpose of this solution, the term “management endpoint” is being used loosely to represent an entity the application can interact with to manage the service secrets. This can be a restful endpoint, a custom API, or simply a file path where config files are stored, thus allowing for a high degree of extensibility.

 

Harpocrates is also being designed to support deployments into various compute platforms such as AKS, App Service, VM, or even ACI or Azure Functions, as well as support a number of different storage technologies as to not place a significant burden on deploying the solution into your own environment. Depicted below are high level deployment diagrams of Harpocrates in AKS and App Service. These are just examples as the solution can be deployed into serverless environments as well. I plan on having an article in this blog series dedicated to specific deployment scenarios.

 

deploy-k8.png
Figure 4 Harpocrates Azure Kubernetes Service Deployment Diagram

 

deploy-appservice.png
Figure 5  Harpocrates Azure AppService Deployment Diagram

 

If you’re still reading this and are interested in learning more about Harpocrates and its journey to addressing this problem space, please take a look at other articles in this blog series and as always, feel free to browse the codebase and provide feedback.

1 Comment
Microsoft