Skip to content

Commit 6274715

Browse files
[Wiki] Added a PowerShell script example to frontload all supported publish locations with all modules (#3043)
* 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 * expanded to Template Specs and ADO artifacts * Update docs/wiki/Getting started - Scenario 1 Consume library.md committing suggested changes Co-authored-by: Alexander Sehr <ASehr@hotmail.de> * Update Getting started - Scenario 1 Consume library.md formatting fixed --------- Co-authored-by: Alexander Sehr <ASehr@hotmail.de>
1 parent 4fee095 commit 6274715

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

docs/wiki/Getting started - Scenario 1 Consume library.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,15 @@ To publish a module by running the script:
8989
```PowerShell
9090
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'
9191
```
92-
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.
92+
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:
93+
94+
```PowerShell
95+
$modules = Get-ChildItem -Path '<pathToModulesFolder>' -Recurse -Filter 'deploy.bicep'
96+
$modules.FullName | ForEach-Object -Parallel {
97+
   . '<pathToPublishScript>\Publish-ModuleToTemplateSpecsRG.ps1'
98+
   Publish-ModuleToTemplateSpecsRG -TemplateFilePath $_ -ModuleVersion '<moduleVersion>' -TemplateSpecsRgName '<templateSpecsRgName>' -TemplateSpecsRgLocation 'West Europe' -TemplateSpecsDescription 'CARML KV Template Spec'
99+
} -ThrottleLimit 4
100+
```
93101
94102
1. Update your master template in order to use the new version of the published modules.
95103
@@ -121,8 +129,15 @@ To publish a module by running the script:
121129
```PowerShell
122130
Publish-ModuleToPrivateBicepRegistry -TemplateFilePath "D:\ResourcesModules\modules\Microsoft.KeyVault\vaults\deploy.bicep" -ModuleVersion "0.4.740" -BicepRegistryName 'adpsxxazacrx001' -BicepRegistryRgName 'artifact-rg'
123131
```
124-
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.
132+
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:
125133
134+
```PowerShell
135+
$modules = Get-ChildItem -Path '<pathToModulesFolder>' -Recurse -Filter 'deploy.bicep'
136+
$modules.FullName | ForEach-Object -Parallel {
137+
   . '<pathToPublishScript>\Publish-ModuleToPrivateBicepRegistry.ps1'
138+
   Publish-ModuleToPrivateBicepRegistry -TemplateFilePath $_ -ModuleVersion '<moduleVersion>' -BicepRegistryName '<registryName>' -BicepRegistryRgName '<bicepRGName>'
139+
} -ThrottleLimit 4
140+
```
126141
1. Update your master template in order to use the new version of the published modules.
127142
128143
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'.
@@ -154,7 +169,16 @@ To publish a module by running the script:
154169
```PowerShell
155170
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'
156171
```
157-
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.
172+
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:
173+
174+
```PowerShell
175+
$modules = Get-ChildItem -Path '<pathToModulesFolder>' -Recurse -Filter 'deploy.bicep'
176+
$modules.FullName | ForEach-Object -Parallel {
177+
   . '<pathToPublishScript>\Publish-ModuleToUniversalArtifactsFeed.ps1'
178+
   Publish-ModuleToUniversalArtifactsFeed -TemplateFilePath $_ -ModuleVersion '<moduleVersion>' VstsOrganizationUri 'https://dev.azure.com/fabrikam' -VstsFeedProject 'IaC' -VstsFeedName 'Artifacts'
179+
} -ThrottleLimit 4
180+
```
181+
158182
159183
1. Update your master template in order to use the new version of the published modules.
160184

0 commit comments

Comments
 (0)