diff --git a/build.proj b/build.proj index aa9c8ced86ea..b49b13d339c6 100644 --- a/build.proj +++ b/build.proj @@ -36,6 +36,7 @@ $(PublishDirectory)\Setup $(PublishDirectory)\TestResults true + http://psget/PSGallery/api/v2/ @@ -115,6 +116,7 @@ $(MSBuildProjectDirectory)\src\.nuget\NuGet.exe $(MSBuildProjectDirectory)\restore.config -ConfigFile "$(NuGetRestoreConfigFile)" + C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe + + + + + + + + false diff --git a/setup-powershellget/Setup/ShortcutStartup.ps1 b/setup-powershellget/Setup/ShortcutStartup.ps1 index 8cca43a090df..fed332e89acc 100644 --- a/setup-powershellget/Setup/ShortcutStartup.ps1 +++ b/setup-powershellget/Setup/ShortcutStartup.ps1 @@ -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 = @" diff --git a/tools/AzureRM/AzureRM.psd1 b/tools/AzureRM/AzureRM.psd1 new file mode 100644 index 000000000000..b59669b2fb87 Binary files /dev/null and b/tools/AzureRM/AzureRM.psd1 differ diff --git a/tools/AzureRM/AzureRM.psm1 b/tools/AzureRM/AzureRM.psm1 new file mode 100644 index 000000000000..dbcfdd49a92b --- /dev/null +++ b/tools/AzureRM/AzureRM.psm1 @@ -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 } +} \ No newline at end of file diff --git a/tools/PublishModules.ps1 b/tools/PublishModules.ps1 index 5a80b036a65c..e8535c77ebc7 100644 --- a/tools/PublishModules.ps1 +++ b/tools/PublishModules.ps1 @@ -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