From e16b430ecec9fcaf8c1c1b55b29ddef529b0e854 Mon Sep 17 00:00:00 2001 From: Oliver Gulich <70239916+oliverlabs@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:01:30 +0000 Subject: [PATCH 1/4] Added a PowerShell script example for mass loading modules to a Bicep registry Added a PowerShell script example for mass loading modules to a Bicep registry --- docs/wiki/Getting started - Scenario 1 Consume library.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/wiki/Getting started - Scenario 1 Consume library.md b/docs/wiki/Getting started - Scenario 1 Consume library.md index 566f2962b0..8d7bec20d7 100644 --- a/docs/wiki/Getting started - Scenario 1 Consume library.md +++ b/docs/wiki/Getting started - Scenario 1 Consume library.md @@ -121,8 +121,14 @@ To publish a module by running the script: ```PowerShell Publish-ModuleToPrivateBicepRegistry -TemplateFilePath "D:\ResourcesModules\modules\Microsoft.KeyVault\vaults\deploy.bicep" -ModuleVersion "0.4.740" -BicepRegistryName 'adpsxxazacrx001' -BicepRegistryRgName 'artifact-rg' ``` - As the modules to be published are more than one a script that calls the `'Publish-ModuleToPrivateBicepRegistry'` function for each of the modules can be created. + If you need to publish more than one module, you could use the following PowerShell script that calls the `'Publish-ModuleToUniversalArtifactsFeed'` function for each of the modules: + ```PowerShell + $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' + $modules.FullName | ForEach-Object -Parallel { +    . '\Publish-ModuleToPrivateBicepRegistry.ps1' +    Publish-ModuleToPrivateBicepRegistry -TemplateFilePath $_ -ModuleVersion '' -BicepRegistryName '' -BicepRegistryRgName '' } -ThrottleLimit 4 + ``` 1. Update your master template in order to use the new version of the published modules. For the [Private Bicep Registry's example in Solutions](./Solution%20creation#examples) page, supposing you have published version '0.4.740' of modules, you need to replace all the occurences of '0.4.735' with '0.4.740'. From bada0e1f95c2dc7ad7cc06765ce2b33a9ff3c269 Mon Sep 17 00:00:00 2001 From: Oliver Gulich <70239916+oliverlabs@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:14:10 +0000 Subject: [PATCH 2/4] expanded to Template Specs and ADO artifacts --- ...ng started - Scenario 1 Consume library.md | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/wiki/Getting started - Scenario 1 Consume library.md b/docs/wiki/Getting started - Scenario 1 Consume library.md index 8d7bec20d7..93c39e8894 100644 --- a/docs/wiki/Getting started - Scenario 1 Consume library.md +++ b/docs/wiki/Getting started - Scenario 1 Consume library.md @@ -89,7 +89,14 @@ To publish a module by running the script: ```PowerShell Publish-ModuleToTemplateSpecsRG -TemplateFilePath "D:\ResourcesModules\modules\Microsoft.KeyVault\vaults\deploy.bicep" -ModuleVersion "0.4.740" -TemplateSpecsRgName 'artifact-rg' -TemplateSpecsRgLocation 'West Europe' -TemplateSpecsDescription 'CARML KV Template Spec' ``` - As the modules to be published are more than one a script that calls the `'Publish-ModuleToTemplateSpecsRG'` function for each of the modules can be created. + If you need to publish more than one module, you could use the following PowerShell script that calls the `'Publish-ModuleToTemplateSpecsRG'` function for each of the modules: + + ```PowerShell + $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' + $modules.FullName | ForEach-Object -Parallel { +    . '\Publish-ModuleToTemplateSpecsRG.ps1' +    Publish-ModuleToTemplateSpecsRG -TemplateFilePath $_ -ModuleVersion '' -TemplateSpecsRgName '' -TemplateSpecsRgLocation 'West Europe' -TemplateSpecsDescription 'CARML KV Template Spec' } -ThrottleLimit 4 + ``` 1. Update your master template in order to use the new version of the published modules. @@ -121,7 +128,7 @@ To publish a module by running the script: ```PowerShell Publish-ModuleToPrivateBicepRegistry -TemplateFilePath "D:\ResourcesModules\modules\Microsoft.KeyVault\vaults\deploy.bicep" -ModuleVersion "0.4.740" -BicepRegistryName 'adpsxxazacrx001' -BicepRegistryRgName 'artifact-rg' ``` - If you need to publish more than one module, you could use the following PowerShell script that calls the `'Publish-ModuleToUniversalArtifactsFeed'` function for each of the modules: + If you need to publish more than one module, you could use the following PowerShell script that calls the `'Publish-ModuleToPrivateBicepRegistry'` function for each of the modules: ```PowerShell $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' @@ -160,7 +167,15 @@ To publish a module by running the script: ```PowerShell Publish-ModuleToUniversalArtifactsFeed -TemplateFilePath "D:\ResourcesModules\modules\Microsoft.KeyVault\vaults\deploy.bicep" -ModuleVersion "0.4.740" -VstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsFeedProject 'IaC' -VstsFeedName 'Artifacts' ``` - As the modules to be published are more than one a script that calls the `'Publish-ModuleToUniversalArtifactsFeed'` function for each of the modules can be created. + If you need to publish more than one module, you could use the following PowerShell script that calls the `'Publish-ModuleToUniversalArtifactsFeed'` function for each of the modules: + + ```PowerShell + $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' + $modules.FullName | ForEach-Object -Parallel { +    . '\Publish-ModuleToUniversalArtifactsFeed.ps1' +    Publish-ModuleToUniversalArtifactsFeed -TemplateFilePath $_ -ModuleVersion '' VstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsFeedProject 'IaC' -VstsFeedName 'Artifacts' } -ThrottleLimit 4 + ``` + 1. Update your master template in order to use the new version of the published modules. From 2f2c6f8792f63a0d23a6f4831e1d6e3537d47c94 Mon Sep 17 00:00:00 2001 From: Oliver Gulich <70239916+oliverlabs@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:16:22 +0000 Subject: [PATCH 3/4] Update docs/wiki/Getting started - Scenario 1 Consume library.md committing suggested changes Co-authored-by: Alexander Sehr --- docs/wiki/Getting started - Scenario 1 Consume library.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/wiki/Getting started - Scenario 1 Consume library.md b/docs/wiki/Getting started - Scenario 1 Consume library.md index 93c39e8894..deff9e46a1 100644 --- a/docs/wiki/Getting started - Scenario 1 Consume library.md +++ b/docs/wiki/Getting started - Scenario 1 Consume library.md @@ -134,7 +134,8 @@ To publish a module by running the script: $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' $modules.FullName | ForEach-Object -Parallel {    . '\Publish-ModuleToPrivateBicepRegistry.ps1' -    Publish-ModuleToPrivateBicepRegistry -TemplateFilePath $_ -ModuleVersion '' -BicepRegistryName '' -BicepRegistryRgName '' } -ThrottleLimit 4 +    Publish-ModuleToPrivateBicepRegistry -TemplateFilePath $_ -ModuleVersion '' -BicepRegistryName '' -BicepRegistryRgName '' + } -ThrottleLimit 4 ``` 1. Update your master template in order to use the new version of the published modules. From 34a9dad6db57a022aab41b9333eda0ca71688b21 Mon Sep 17 00:00:00 2001 From: Oliver Gulich <70239916+oliverlabs@users.noreply.github.com> Date: Thu, 23 Mar 2023 11:22:41 +0000 Subject: [PATCH 4/4] Update Getting started - Scenario 1 Consume library.md formatting fixed --- docs/wiki/Getting started - Scenario 1 Consume library.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/wiki/Getting started - Scenario 1 Consume library.md b/docs/wiki/Getting started - Scenario 1 Consume library.md index deff9e46a1..a01b7009f4 100644 --- a/docs/wiki/Getting started - Scenario 1 Consume library.md +++ b/docs/wiki/Getting started - Scenario 1 Consume library.md @@ -95,7 +95,8 @@ To publish a module by running the script: $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' $modules.FullName | ForEach-Object -Parallel {    . '\Publish-ModuleToTemplateSpecsRG.ps1' -    Publish-ModuleToTemplateSpecsRG -TemplateFilePath $_ -ModuleVersion '' -TemplateSpecsRgName '' -TemplateSpecsRgLocation 'West Europe' -TemplateSpecsDescription 'CARML KV Template Spec' } -ThrottleLimit 4 +    Publish-ModuleToTemplateSpecsRG -TemplateFilePath $_ -ModuleVersion '' -TemplateSpecsRgName '' -TemplateSpecsRgLocation 'West Europe' -TemplateSpecsDescription 'CARML KV Template Spec' + } -ThrottleLimit 4 ``` 1. Update your master template in order to use the new version of the published modules. @@ -174,7 +175,8 @@ To publish a module by running the script: $modules = Get-ChildItem -Path '' -Recurse -Filter 'deploy.bicep' $modules.FullName | ForEach-Object -Parallel {    . '\Publish-ModuleToUniversalArtifactsFeed.ps1' -    Publish-ModuleToUniversalArtifactsFeed -TemplateFilePath $_ -ModuleVersion '' VstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsFeedProject 'IaC' -VstsFeedName 'Artifacts' } -ThrottleLimit 4 +    Publish-ModuleToUniversalArtifactsFeed -TemplateFilePath $_ -ModuleVersion '' VstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsFeedProject 'IaC' -VstsFeedName 'Artifacts' + } -ThrottleLimit 4 ```