Home
%3CLINGO-SUB%20id%3D%22lingo-sub-324773%22%20slang%3D%22en-US%22%3EUsing%20PowerShell%20to%20import%20and%20export%20Azure%20Blueprints%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324773%22%20slang%3D%22en-US%22%3E%3CP%3EI%E2%80%99ve%20previously%20written%20an%20overview%20of%20what%20Azure%20Blueprints%20are%20and%20why%20you%E2%80%99d%20use%20them%2C%20so%20if%20you%20are%20unfamiliar%20with%20them%2C%20check%20out%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FITOps-Talk-Blog%2FGetting-started-with-Azure-Blueprints%2Fba-p%2F323449%3FWT.mc_id%3DITOpsTalk-blog-socuff%22%20target%3D%22_self%22%3EGetting%20started%20with%20Azure%20Blueprints.%26nbsp%3B%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20the%20Azure%20Blueprints%20service%20is%20still%20in%20Preview%2C%20you%20won%E2%80%99t%20find%20a%20full-featured%20set%20of%20supporting%20PowerShell%20commands%20just%20yet.%20However%20there%20is%20one%20handy%20little%20command%20currently%20in%20the%20PowerShell%20gallery%20which%20gives%20you%20some%20functionality%20you%20won%E2%80%99t%20find%20in%20the%20Azure%20Portal.%20Introducing%20%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FManage-AzureRMBlueprint%3FWT.mc_id%3DITOpsTalk-blog-socuff%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EManage-AzureRMBlueprint%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EUse%20cases%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EAzure%20Blueprints%20give%20you%20an%20easy%20way%20to%20bundle%20together%20governance%20artifacts%20like%20Azure%20Policy%2C%20RBAC%20and%20Resource%20Manager%20Templates%2C%20then%20apply%20them%20to%20the%20relevant%20subscriptions%20under%20a%20management%20group.%20But%20what%20if%20you%20want%20to%20duplicate%20these%20across%20to%20a%20subscription%20in%20a%20different%20management%20group%3F%20There%E2%80%99s%20no%20copy%20and%20paste%20capability%20in%20the%20portal%20for%20that%2C%20so%20the%20PowerShell%20command%20can%20help.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWith%20the%20appropriate%20switch%2C%20we%20can%20use%20this%20PowerShell%20command%20to%20export%20the%20details%20of%20an%20existing%20Blueprint%20into%20.json%20files.%20That%20includes%20both%20the%20Blueprint%20definition%20and%20the%20corresponding%20artifacts%20contained%20inside%20it.%20And%20with%20the%20import%20switch%2C%20we%20can%20then%20easily%20upload%20those%20files%20into%20a%20different%20management%20group%2C%20ready%20for%20the%20Blueprint%20to%20then%20be%20assigned%20to%20the%20relevant%20subscriptions.%20During%20the%20import%20process%2C%20we%20can%20even%20change%20the%20name%20of%20the%20Blueprint%20itself.%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%20style%3D%22width%3A%20716px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70805iAC7D005C5747E85A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Blueprint-JSON.jpg%22%20title%3D%22Blueprint-JSON.jpg%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAzure%20Blueprint%20exported%20to%20.json%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20functionality%20is%20helpful%20if%20you%E2%80%99ve%20made%20changes%20to%20a%20Blueprint%20and%20tested%20it%20against%20your%20test%20environment%20subscriptions%2C%20and%20now%20you%20want%20to%20move%20it%20across%20to%20apply%20to%20your%20production%20subscriptions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%E2%80%99s%20also%20handy%20for%20anyone%20who%20manages%20multiple%20different%20Azure%20customer%20environments%20(Azure%20tenancies)%2C%20such%20as%20Managed%20Service%20Providers%20or%20Partners%20and%20even%20larger%20Enterprises%20who%20may%20have%20their%20environments%20segregated%20for%20legal%20or%20financial%20reasons.%20Now%20you%20can%20define%20a%20base%20Blueprint%20with%20your%20standard%20governance%20requirements%20and%20connect%20to%20your%20different%20Azure%20tenancies%20to%20import%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20finally%2C%20with%20the%20Report%20switch%20you%20can%20see%20the%20details%20of%20what%20is%20configured%20in%20a%20Blueprint%2C%20without%20leaving%20the%20comfort%20of%20your%20PowerShell%20window.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ELimitations%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EVersion%202.2%20only%20supports%20exporting%20the%20latest%20version%20of%20a%20published%20blueprint%2C%20or%20the%20current%20version%20of%20a%20draft%20blueprint.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt%E2%80%99s%20also%20important%20to%20note%20that%20the%20command%20only%20lets%20you%20export%20built-in%20policy%20definitions%2C%20not%20custom%20policies.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EA%20note%20on%20the%20command%20syntax%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ENow%20that%20we%E2%80%99re%20moving%20away%20from%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fpowershell%2Fazure%2Fnew-azureps-module-az%3Fview%3Dazps-1.1.0%26amp%3BWT.mc_id%3DITOpsTalk-blog-socuff%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzureRM-style%20commands%20in%20favor%20of%20Az%20module%20commands%3C%2FA%3E%2C%26nbsp%3Bthis%20script%20supports%20both.%20Use%20the%20-ModuleMode%20switch%20to%20specify%20either%20AzureRM%20or%20Az%2C%20depending%20on%20how%20your%20PowerShell%20environment%20is%20currently%20configured.%20Miss%20this%20switch%20and%20you%20may%20get%20errors!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWithin%20a%20PowerShell%20terminal%20that%E2%80%99s%20already%20authenticated%20to%20an%20Azure%20tenancy%2C%20this%20script%20can%20run%20with%20minimal%20input.%20With%20only%20the%20ModuleMode%2C%20Mode%2C%20and%20an%20import%20or%20export%20directory%2C%20the%20command%20will%20read%20the%20available%20subscriptions%2C%20management%20groups%20and%20blueprints%20and%20will%20pause%20for%20you%20to%20enter%20your%20selections.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOr%20you%20can%20specify%20those%20components%20with%20the%20SubscriptionID%2C%20ManagementGroupID%20and%20BlueprintName%20parameters%20and%20then%20use%20the%20Force%20switch%20to%20suppress%20any%20confirmation%20prompts.%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%20style%3D%22width%3A%20946px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70806i29996E2D5DEA78EB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Manage-AzureRMBlueprint-Import.jpg%22%20title%3D%22Manage-AzureRMBlueprint-Import.jpg%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EManage-AzureRMBlueprint%20Import%20mode%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ESupported%20environments%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EVersion%202.2%20now%20also%20include%20cross%20platform%20support%2C%20so%20it%E2%80%99s%20functional%20on%20both%20Windows%20PowerShell%20and%20PS%20Core%2C%20including%20on%20Mac%20and%20Linux.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3ETo%20learn%20more%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3ETo%20download%20the%20latest%20version%20of%20the%20command%20and%20see%20the%20official%20documentation%2C%20visit%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FManage-AzureRMBlueprint%3FWT.mc_id%3DITOpsTalk-blog-socuff%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPowerShell%20Gallery%20page%20for%20Manage-AzureRMBlueprint%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOr%20join%20us%20at%20a%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fignite-the-tour%2F%3FWT.mc_id%3DITOpsTalk-blog-socuff%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EMicrosoft%20Ignite%20%7C%20The%20Tour%3C%2FA%3E%20city%2C%20where%20we%E2%80%99ll%20demonstrate%20this%20command%20in%20action%20during%20session%20HYB40%3A%20Governing%20your%20Azure%20environment%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAnd%20stay%20tuned%20for%20news%20on%20when%20more%20Azure%20Blueprints%20PowerShell%20commands%20are%20released.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-324773%22%20slang%3D%22en-US%22%3E%3CP%3ELearn%20how%20to%20export%20and%20import%20Azure%20Blueprints%20to%20different%20subscriptions%20or%20tenancies%2C%20with%20PowerShell%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20946px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F70806i29996E2D5DEA78EB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Manage-AzureRMBlueprint-Import.jpg%22%20title%3D%22Manage-AzureRMBlueprint-Import.jpg%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EManage-AzureRMBlueprint%20Import%20mode%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-324773%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-325313%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20PowerShell%20to%20import%20and%20export%20Azure%20Blueprints%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-325313%22%20slang%3D%22en-US%22%3E%3CP%3EYou've%20now%20got%20me%20thinking%20about%20how%20that%20would%20be%20possible.%20You'd%20need%20to%20use%20Resource%20Manager%20Templates%20and%20somehow%20pass%20the%20naming%20parameters%2FIP%20addresses%20etc%20from%20Visio.%20That%20would%20be%20the%20tricky%20part%20as%20I%20don't%20know%20think%20that%26nbsp%3B%20Visio%20can%20categorise%20all%20the%20icon%20labels.%20It%20would%20be%20very%20cool%20though!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-324930%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20PowerShell%20to%20import%20and%20export%20Azure%20Blueprints%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-324930%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EThis%20is%20Heck%20of%20a%20great%20request.%20What%20I%20would%20like%20to%20have%20is%20the%20ability%20to%20take%20my%20Visio%20cloud%20drawings%20that%20I%20create%20and%20export%20them%20right%20into%20Azure%20and%20have%20that%20system%20created%20in%20the%20Azure%20cloud.%20That%20way%20users%20new%20to%20Azure%20can%20convert%20their%20environment%20directly%20to%20the%20cloud.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

I’ve previously written an overview of what Azure Blueprints are and why you’d use them, so if you are unfamiliar with them, check out Getting started with Azure Blueprints. 

 

As the Azure Blueprints service is still in Preview, you won’t find a full-featured set of supporting PowerShell commands just yet. However there is one handy little command currently in the PowerShell gallery which gives you some functionality you won’t find in the Azure Portal. Introducing Manage-AzureRMBlueprint 

 

Use cases

Azure Blueprints give you an easy way to bundle together governance artifacts like Azure Policy, RBAC and Resource Manager Templates, then apply them to the relevant subscriptions under a management group. But what if you want to duplicate these across to a subscription in a different management group? There’s no copy and paste capability in the portal for that, so the PowerShell command can help.

 

With the appropriate switch, we can use this PowerShell command to export the details of an existing Blueprint into .json files. That includes both the Blueprint definition and the corresponding artifacts contained inside it. And with the import switch, we can then easily upload those files into a different management group, ready for the Blueprint to then be assigned to the relevant subscriptions. During the import process, we can even change the name of the Blueprint itself.

 

Blueprint-JSON.jpgAzure Blueprint exported to .json

 

This functionality is helpful if you’ve made changes to a Blueprint and tested it against your test environment subscriptions, and now you want to move it across to apply to your production subscriptions.

 

It’s also handy for anyone who manages multiple different Azure customer environments (Azure tenancies), such as Managed Service Providers or Partners and even larger Enterprises who may have their environments segregated for legal or financial reasons. Now you can define a base Blueprint with your standard governance requirements and connect to your different Azure tenancies to import it.

 

And finally, with the Report switch you can see the details of what is configured in a Blueprint, without leaving the comfort of your PowerShell window.  

 

Limitations

Version 2.2 only supports exporting the latest version of a published blueprint, or the current version of a draft blueprint.

 

It’s also important to note that the command only lets you export built-in policy definitions, not custom policies.

 

A note on the command syntax

Now that we’re moving away from AzureRM-style commands in favor of Az module commands, this script supports both. Use the -ModuleMode switch to specify either AzureRM or Az, depending on how your PowerShell environment is currently configured. Miss this switch and you may get errors!

 

Within a PowerShell terminal that’s already authenticated to an Azure tenancy, this script can run with minimal input. With only the ModuleMode, Mode, and an import or export directory, the command will read the available subscriptions, management groups and blueprints and will pause for you to enter your selections.

 

Or you can specify those components with the SubscriptionID, ManagementGroupID and BlueprintName parameters and then use the Force switch to suppress any confirmation prompts.

 

Manage-AzureRMBlueprint-Import.jpgManage-AzureRMBlueprint Import mode

 

Supported environments

Version 2.2 now also include cross platform support, so it’s functional on both Windows PowerShell and PS Core, including on Mac and Linux.  

 

To learn more

To download the latest version of the command and see the official documentation, visit the PowerShell Gallery page for Manage-AzureRMBlueprint 

 

Or join us at a Microsoft Ignite | The Tour city, where we’ll demonstrate this command in action during session HYB40: Governing your Azure environment 

 

And stay tuned for news on when more Azure Blueprints PowerShell commands are released.

 

2 Comments
Occasional Visitor

This is Heck of a great request. What I would like to have is the ability to take my Visio cloud drawings that I create and export them right into Azure and have that system created in the Azure cloud. That way users new to Azure can convert their environment directly to the cloud.

Microsoft

You've now got me thinking about how that would be possible. You'd need to use Resource Manager Templates and somehow pass the naming parameters/IP addresses etc from Visio. That would be the tricky part as I don't know think that  Visio can categorise all the icon labels. It would be very cool though!