Skip to content

lulzzz/Structurizr.InfrastructureAsCode

 
 

Repository files navigation

Structurizr.InfrastructureAsCode

Structurizr.InfrastructureAsCode is a library that uses both Structurizr for .NET and the Azure SDK for .NET to provide an easy to use architecture- and infrastructure-as-code solution. Currently, there is only an implementation for Azure resources available.

How to desribe your architecture and infrastructure

You can find a sample implementation here.

Create the architecture and infrastructure model

  • Create a subclass of SoftwareSystemWithInfrastructure which will describe your software system. For this, you will use Structurizrs Workspace, SoftwareSystem and Container classes. See the sample projects Monkey factory system
  • Create subclasses of ContainerWithInfrastructure which will describe individual containers and their corresponding cloud infrastructure. See the sample projects UI container

Use Structurizr to render the model to architecture diagrams

Since the model you created in the first step uses Structurizrs SDK to describe the architecture of your software system, you can use the Strucurizr API to render / upload that model directly to Structurizr.

Use Structurizr.InfrastructureAsCode to render the model to Azure resources

Before creating any Azure resoures, you will need to

  • Implement a console application similar to the sample
  • create an Azure AD application that will be used by that console application to authenticate against the Azure Resource Manager API (DEPRECATED: it's better to create a service principal using a self signed certificate for authentication, instead. A how to for this will follow)
    • Login to the Azure portal
    • Open your Active Directory
    • Open the App Registrations blade
    • Create a "New application registration"
      • Application type "Native"
      • Create a key in the Apps "Keys" blade and note down its value. You will need this key to authenticate.
      • Open the "Required permissions" of the App and add the folowing permissions (I am not sure if you need all of them):
        • Microsoft.Azure.ActiveDirectory: Read directory data, Access the directory as the signed-in user
        • Microsoft Graph: Read and write Microsoft Intune RBAC settings (preview), Read and write Microsoft Intune apps (preview), Read and write all groups, Read and write directory data, Access directory as the signed in user
        • Windows Azure Service Management API: Access Azure Service Management as organization users (preview)
  • Use the InfrastructureRendererBuilder class in the console app to create an Azure InfrastructureRenderer. See the sample Program.cs. Here you will need to pass in the credentials to access your Azure subscription. These should not be your personal credentials, but the credentials (key) you just created for the Azure AD Application.
  • Use pass your model (the SoftwareSystemWithInfrastructure subclass) to that renderer. This will create the resources defined as the infrastructure elements in your model in your Azure subscription.

Contribute: How to extend Structurizr.InfrastructureAsCode to support additional resource types

TBD

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 99.3%
  • PowerShell 0.7%