Skip to content

Added AzureRM installer PS scripts #964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<SetupOutputDirectory>$(PublishDirectory)\Setup</SetupOutputDirectory>
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' != '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
</PropertyGroup>
<ItemGroup>
<AzureResourceManagerSln Include=".\src\ResourceManager.sln" />
Expand Down Expand Up @@ -115,6 +116,7 @@
<NuGetCommand>$(MSBuildProjectDirectory)\src\.nuget\NuGet.exe</NuGetCommand>
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
<NuGetRestoreConfigSwitch>-ConfigFile &quot;$(NuGetRestoreConfigFile)&quot;</NuGetRestoreConfigSwitch>
<PowerShellCommand>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -285,6 +287,14 @@
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
</Target>

<!-- Publish all packages -->
<Target Name="Publish" DependsOnTargets="Build">
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
<Message Importance="high" Text="Publishing Cmdlets..." />

<Exec Command="$(PowerShellCommand) -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\PublishModules.ps1 $(Configuration) $(NuGetKey) \&quot;$(NuGetPublishingSource)\&quot;&quot;"/>
</Target>

<PropertyGroup>
<RunTestLive Condition="'$(RunTestLive)' == ''">false</RunTestLive>
Expand Down
10 changes: 8 additions & 2 deletions setup-powershellget/Setup/ShortcutStartup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ Finalizing installation of Azure PowerShell.
Installing Azure Modules from PowerShell Gallery.
This may take some time...
"@
Import-Module PackageManagement
Get-PackageProvider -Name NuGet -ForceBootstrap
Install-Module AzureRM.Installer
Install-AzureRM

$NuGetPublishingSource = $env:NuGetPublishingSource
if ([string]::IsNullOrWhiteSpace($NuGetPublishingSource)) {
Install-Module AzureRM -Repository $NuGetPublishingSource
} else {
Install-Module AzureRM
}
} else {
cd c:\
$welcomeMessage = @"
Expand Down
Binary file added tools/AzureRM/AzureRM.psd1
Binary file not shown.
48 changes: 48 additions & 0 deletions tools/AzureRM/AzureRM.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<#
.Synopsis
Install Azure Resource Manager cmdlet modules

.Description
Installs all the available Azure Resource Manager cmdlet modules that start with "AzureRM".

.Parameter Repository
Limit the search for "AzureRM" cmdlets in a specific repository.

.Parameter Scope
Specifies the parameter scope.
#>
function Update-AzureRM
{
param(
[Parameter(Position=0, Mandatory = $false)]
[string]
$Repository,

[Parameter(Position=1, Mandatory = $false)]
[ValidateSet("CurrentUser","AllUsers")]
[string]
$Scope)

if ([string]::IsNullOrWhiteSpace($Scope))
{
$Scope = "AllUsers"
}

Install-Module AzureRM.Profile -Repository $Repository
if ([string]::IsNullOrWhiteSpace($Repository))
{
$modules = Find-Module -Name AzureRM.* | Where-Object {$_.Name -ne "AzureRM" -and $_.Name -ne "AzureRM.Profile"}
} else {
$modules = Find-Module -Repository $Repository | Where-Object {$_.Name -like "AzureRM.*" -and $_.Name -ne "AzureRM" -and $_.Name -ne "AzureRM.Profile"}
}

Write-Output "Installing $($modules.Length) AzureRM modules. This may take a few minutes."

$result = $modules | ForEach {
Start-Job -Name $_.Name -ScriptBlock {
Install-Module -Name $args[0] -Repository $args[1] -Scope $args[2]
Write-Output "$($args[0]) installed..."
} -ArgumentList $_.Name, $Repository, $Scope }

$modules | ForEach {Get-Job -Name $_.Name | Wait-Job | Receive-Job }
}
9 changes: 0 additions & 9 deletions tools/PublishModules.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ if ([string]::IsNullOrEmpty($repositoryLocation))
}

$packageFolder = "$PSScriptRoot\..\src\Package"
$scriptFolder = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
. ($scriptFolder + '.\SetupEnv.ps1')

if (Test-Path $packageFolder) {
Remove-Item -Path $packageFolder -Recurse -Force
}

# Build the cmdlets in debug mode
msbuild "$env:AzurePSRoot\build.proj" /t:"BuildDebug"

$repoName = $(New-Guid).ToString()
Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation -InstallationPolicy Trusted
Expand Down