Skip to content

Commit abb97cd

Browse files
authored
Merge pull request Azure#4268 from markcowl/fixbootstrap
Updating online help and ShouldProcess for BootStrapper cmdlets
2 parents 1ec8563 + 624f793 commit abb97cd

15 files changed

+1009
-270
lines changed

tools/AzureRM.BootStrapper/AzureRM.BootStrapper.psd1

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Microsoft Corporation
55
#
6-
# Generated on: 3/10/2017
6+
# Generated on: 7/6/2017
77
#
88

99
@{
@@ -63,20 +63,23 @@ CLRVersion = '4.0'
6363
# TypesToProcess = @()
6464

6565
# Format files (.ps1xml) to be loaded when importing this module
66-
FormatsToProcess = '.\AzureRM.Bootstrapper.Format.ps1xml'
66+
FormatsToProcess = 'AzureRM.Bootstrapper.Format.ps1xml'
6767

6868
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
6969
# NestedModules = @()
7070

7171
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
72-
FunctionsToExport = 'Set-BootstrapRepo', 'Update-AzureRmProfile', 'Uninstall-AzureRmProfile',
73-
'Install-AzureRmProfile', 'Use-AzureRmProfile', 'Get-AzureRmProfile',
74-
'Get-AzureRmModule', 'Set-AzureRmDefaultProfile', 'Remove-AzureRmDefaultProfile', 'Get-ModuleVersion'
72+
FunctionsToExport = 'Set-BootstrapRepo', 'Update-AzureRmProfile',
73+
'Uninstall-AzureRmProfile', 'Install-AzureRmProfile',
74+
'Use-AzureRmProfile', 'Get-AzureRmProfile', 'Get-AzureRmModule',
75+
'Set-AzureRmDefaultProfile', 'Remove-AzureRmDefaultProfile',
76+
'Get-ModuleVersion'
7577

7678
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
7779
CmdletsToExport = 'Update-AzureRmProfile', 'Uninstall-AzureRmProfile',
7880
'Install-AzureRmProfile', 'Use-AzureRmProfile', 'Get-AzureRmProfile',
79-
'Get-AzureRmModule', 'Set-AzureRmDefaultProfile', 'Remove-AzureRmDefaultProfile'
81+
'Get-AzureRmModule', 'Set-AzureRmDefaultProfile',
82+
'Remove-AzureRmDefaultProfile'
8083

8184
# Variables to export from this module
8285
# VariablesToExport = @()

tools/AzureRM.BootStrapper/AzureRM.Bootstrapper.psm1

+7-4
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ function Use-AzureRmProfile
10701070
#>
10711071
function Install-AzureRmProfile
10721072
{
1073-
[CmdletBinding()]
1073+
[CmdletBinding(SupportsShouldProcess=$true)]
10741074
param()
10751075
DynamicParam
10761076
{
@@ -1110,9 +1110,12 @@ function Install-AzureRmProfile
11101110
{
11111111
$versions = $ProfileMap.$Profile.$Module
11121112
$version = Get-LatestModuleVersion -versions $versions
1113-
Write-Progress -Activity "Installing Module $Module version: $version" -Status "Progress:" -PercentComplete ($ModuleCount/($Modules.Length)*100)
1114-
Write-Verbose "Installing module $module"
1115-
Invoke-InstallModule -module $Module -version $version -scope $scope
1113+
if ($PSCmdlet.ShouldProcess($Module, "Installing Module $Module version: $version"))
1114+
{
1115+
Write-Progress -Activity "Installing Module $Module version: $version" -Status "Progress:" -PercentComplete ($ModuleCount/($Modules.Length)*100)
1116+
Write-Verbose "Installing module $module"
1117+
Invoke-InstallModule -module $Module -version $version -scope $scope
1118+
}
11161119
}
11171120
}
11181121
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
TOPIC
2+
about_version_profiles
3+
4+
SHORT DESCRIPTION
5+
Version profiles provide a mechanism for managing powershell cmdlets that
6+
target specific versions of azure services supported in different instances
7+
of Azure.
8+
9+
LONG DESCRIPTION
10+
Different concrete instances of Azure (AzureCloud, AzureChinaCloud,
11+
AzureGermanCloud, AzureUSGovernmentCloud, AzureStack) may have different
12+
versions of Azure services installed, with different capabilities. Azure
13+
Version Profiles provide a mechanism for managing these version differences.
14+
15+
Each Azure instance has a discoverable set of supported version profiles.
16+
17+
A user can select a version profile supported by the instances of Azure they
18+
target, and this version profile corresponds to versions of the Azure
19+
PowerShell modules. Users can then select these Azure PowerShell module
20+
versions and be confident that their scripts will work when targeting those
21+
Azure instances.
22+
The AzureRM.Bootstrapper module provides cmdlets to discover, acquire, and
23+
use modules that are appropriate for the azure version profile you are targeting.
24+
You can also use Tags in the AzureRM modules to discover profile information
25+
for each module version.
26+
27+
Tags for a Profile use the form VersionProfile:2017-03-09-profile
28+
The AzureRM bootstrapper module uses the PowerShell Gallery to install and
29+
load needed modules when you want to target a specific version profile.
30+
31+
EXAMPLES
32+
Finding appropriate version profiles
33+
Use the Get-AzureRmProfile cmdlet to discover available profile versions,
34+
and profile versions supported by an Azure instance.
35+
36+
Get-AzureRmProfile -ListAvailable
37+
38+
lists all available version profiles.
39+
40+
Use-AzureRmProfile -Profile 2017-03-09-profile
41+
42+
Installs and loads cmdlets for one of the listed profiles.
43+
44+
Targeting all Azure Instances
45+
Get-AzureRmProfile
46+
47+
Lists the profiles that are currently installed on the machine.
48+
49+
Use-AzureRmProfile -Profile 2017-03-09-profile
50+
51+
Installs and loads cmdlets compatible with one of the listed profiles.
52+
53+
Targeting the Latest Stable Features
54+
Use-AzureRmProfile -Profile Latest
55+
56+
Installs and loads the latest published cmdlets for Azure PowerShell.
57+
58+
Acquiring and Loading All Azure modules using the BootStrapper
59+
Use-AzureRmProfile -Profile '2017-03-09-profile' -Force
60+
61+
Checks if modules compatible with the '2017-03-09-profile' profile are
62+
installed in the current scope, downloads and installs the modules if
63+
necessary, and then loads the modules in the current session. You must
64+
open a new PowerShell session to target a different version profile. Using
65+
the 'Force' parameter installs the necessary modules without prompting.
66+
67+
Acquiring and Loading Selected Azure modules using the Bootstrapper
68+
Use-AzureRmProfile -Profile '2017-03-09-profile' -Module AzureRM.Compute
69+
70+
Checks if an AzureRM.Compute module compatible with the
71+
'2017-03-09-profile' profile is installed in the current scope, downloads
72+
and installs the module if necessary, and then loads the module in the
73+
current session. You must open a new PowerShell session to target a
74+
different module.
75+
76+
Switching Between Version Profiles
77+
To switch between version profiles on a machine, in a new PowerShell window,
78+
execute the following cmdlet:
79+
80+
Use-AzureRmProfile -Profile '2017-03-09-profile'
81+
82+
This loads the modules associated with the '2017-03-09-profile' profile in
83+
the current session. You must open a new PowerShell session to target a
84+
different version profile.
85+
86+
87+
Updating and Removing Profiles
88+
To update a profile to the latest versions in that profile and import
89+
updated modules to the current session, execute the following cmdlet:
90+
91+
Update-AzureRmProfile -Profile 'latest'
92+
93+
This checks if the latest versions of Azure PowerShell modules are
94+
installed, if not prompts the user if they should be installed and imports
95+
them into the current session. This should always be executed in a new
96+
PowerShell session.
97+
If you would like to update to the latest modules in a Profile and remove
98+
previously installed versions of the modules, use:
99+
100+
Update-AzureRmProfile -Profile 'latest' -RemovePreviousVersions
101+
102+
Setting and Removing Default Profiles
103+
To set or update a profile as a default to be used with all Azure PowerShell
104+
modules, execute the following cmdlet:
105+
106+
Set-AzureRmDefaultProfile -Profile '2017-03-09-profile'
107+
108+
The default profile selection is persisted across shells and sessions.
109+
After default profile is set using the above cmdlet, the 'Import-Module'
110+
when used with AzureRm modules will automatically load Azure PowerShell
111+
modules compatible with the given profile. You may also use API version
112+
profile cmdlets without the '-profile' parameter.
113+
114+
Import-Module AzureRM.Compute
115+
Use-AzureRmProfile
116+
Uninstall-AzureRmProfile
117+
118+
To remove a default profile from all sessions and shells, execute the
119+
following cmdlet:
120+
121+
Remove-AzureRmDefaultProfile
122+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
Module Name: AzureRM.BootStrapper
3+
Module Guid: 30d8a5cf-3ee5-49ce-b9b0-a4d000d65161
4+
Download Help Link: {{Please enter FwLink manually}}
5+
Help Version: {{Please enter version of help manually (X.X.X.X) format}}
6+
Locale: en-US
7+
---
8+
9+
# AzureRM.BootStrapper Module
10+
## Description
11+
{{Manually Enter Description Here}}
12+
13+
## AzureRM.BootStrapper Cmdlets
14+
### [Get-AzureRmModule](Get-AzureRmModule.md)
15+
{{Manually Enter Get-AzureRmModule Description Here}}
16+
17+
### [Get-AzureRmProfile](Get-AzureRmProfile.md)
18+
{{Manually Enter Get-AzureRmProfile Description Here}}
19+
20+
### [Get-ModuleVersion](Get-ModuleVersion.md)
21+
{{Manually Enter Get-ModuleVersion Description Here}}
22+
23+
### [Install-AzureRmProfile](Install-AzureRmProfile.md)
24+
{{Manually Enter Install-AzureRmProfile Description Here}}
25+
26+
### [Remove-AzureRmDefaultProfile](Remove-AzureRmDefaultProfile.md)
27+
{{Manually Enter Remove-AzureRmDefaultProfile Description Here}}
28+
29+
### [Set-AzureRmDefaultProfile](Set-AzureRmDefaultProfile.md)
30+
{{Manually Enter Set-AzureRmDefaultProfile Description Here}}
31+
32+
### [Set-BootstrapRepo](Set-BootstrapRepo.md)
33+
{{Manually Enter Set-BootstrapRepo Description Here}}
34+
35+
### [Uninstall-AzureRmProfile](Uninstall-AzureRmProfile.md)
36+
{{Manually Enter Uninstall-AzureRmProfile Description Here}}
37+
38+
### [Update-AzureRmProfile](Update-AzureRmProfile.md)
39+
{{Manually Enter Update-AzureRmProfile Description Here}}
40+
41+
### [Use-AzureRmProfile](Use-AzureRmProfile.md)
42+
{{Manually Enter Use-AzureRmProfile Description Here}}
43+

0 commit comments

Comments
 (0)