Skip to content

Commit 06df4ed

Browse files
committed
Added AzureRM installer
1 parent 3cfe7dc commit 06df4ed

File tree

5 files changed

+58
-57
lines changed

5 files changed

+58
-57
lines changed

build.proj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<SetupOutputDirectory>$(PublishDirectory)\Setup</SetupOutputDirectory>
3737
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
3838
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
39+
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' != '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
3940
</PropertyGroup>
4041
<ItemGroup>
4142
<AzureResourceManagerSln Include=".\src\ResourceManager.sln" />
@@ -292,7 +293,7 @@
292293
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
293294
<Message Importance="high" Text="Publishing Cmdlets..." />
294295

295-
<Exec Command="$(PowerShellCommand) -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\PublishModules.ps1 $(Configuration) $(NuGetKey) \&quot;$(LibrarySourceFolder)\Package\$(Configuration)\&quot;&quot;"/>
296+
<Exec Command="$(PowerShellCommand) -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\PublishModules.ps1 $(Configuration) $(NuGetKey) \&quot;$(NuGetPublishingSource)\&quot;&quot;"/>
296297
</Target>
297298

298299
<PropertyGroup>

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,15 @@ Finalizing installation of Azure PowerShell.
2626
Installing Azure Modules from PowerShell Gallery.
2727
This may take some time...
2828
"@
29+
Import-Module PackageManagement
2930
Get-PackageProvider -Name NuGet -ForceBootstrap
30-
Install-Module AzureRM.Installer
31+
32+
$NuGetPublishingSource = $env:NuGetPublishingSource
33+
if ([string]::IsNullOrWhiteSpace($NuGetPublishingSource)) {
34+
Install-Module AzureRM -Repository $NuGetPublishingSource
35+
} else {
36+
Install-Module AzureRM
37+
}
3138
} else {
3239
cd c:\
3340
$welcomeMessage = @"

tools/AzureRM.Installer/AzureRM.Installer.psm1

Lines changed: 0 additions & 55 deletions
This file was deleted.

tools/AzureRM/AzureRM.psm1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<#
2+
.Synopsis
3+
Install Azure Resource Manager cmdlet modules
4+
5+
.Description
6+
Installs all the available Azure Resource Manager cmdlet modules that start with "AzureRM".
7+
8+
.Parameter Repository
9+
Limit the search for "AzureRM" cmdlets in a specific repository.
10+
11+
.Parameter Scope
12+
Specifies the parameter scope.
13+
#>
14+
function Update-AzureRM
15+
{
16+
param(
17+
[Parameter(Position=0, Mandatory = $false)]
18+
[string]
19+
$Repository,
20+
21+
[Parameter(Position=1, Mandatory = $false)]
22+
[ValidateSet("CurrentUser","AllUsers")]
23+
[string]
24+
$Scope)
25+
26+
if ([string]::IsNullOrWhiteSpace($Scope))
27+
{
28+
$Scope = "AllUsers"
29+
}
30+
31+
Install-Module AzureRM.Profile -Repository $Repository
32+
if ([string]::IsNullOrWhiteSpace($Repository))
33+
{
34+
$modules = Find-Module -Name AzureRM.* | Where-Object {$_.Name -ne "AzureRM" -and $_.Name -ne "AzureRM.Profile"}
35+
} else {
36+
$modules = Find-Module -Repository $Repository | Where-Object {$_.Name -like "AzureRM.*" -and $_.Name -ne "AzureRM" -and $_.Name -ne "AzureRM.Profile"}
37+
}
38+
39+
Write-Output "Installing $($modules.Length) AzureRM modules. This may take a few minutes."
40+
41+
$result = $modules | ForEach {
42+
Start-Job -Name $_.Name -ScriptBlock {
43+
Install-Module -Name $args[0] -Repository $args[1] -Scope $args[2]
44+
Write-Output "$($args[0]) installed..."
45+
} -ArgumentList $_.Name, $Repository, $Scope }
46+
47+
$modules | ForEach {Get-Job -Name $_.Name | Wait-Job | Receive-Job }
48+
}

0 commit comments

Comments
 (0)