Skip to content

Retain scripts in roll-up module and fix issue with cdn commands #2020

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 2 commits into from
Mar 28, 2016
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
8 changes: 4 additions & 4 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@
<Component Id="cmp048B605B1072F4A5467F2AFFD8ED2459" Guid="*">
<File Id="fil38FE506241BEC2CA3B34645613B821F3" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.AzureStackAdmin\Microsoft.AzureStack.Commands.dll" />
</Component>
<Component Id="cmpB2F2FF5F057BDE656891B43C18ADF020" Guid="*">
<File Id="fil952FAF0371C7CCC373DBDF330DB18A87" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.AzureStackAdmin\Microsoft.AzureStack.Commands.dll-help.psd1" />
</Component>
<Component Id="cmp889E4CFA9046EFFEFF5D63CB61E990A6" Guid="*">
<File Id="filE0954BDD89FA012B32E270ADA2F66DD8" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.AzureStackAdmin\Microsoft.AzureStack.Commands.dll-help.xml" />
</Component>
Expand Down Expand Up @@ -506,6 +503,9 @@
<Component Id="cmp87DFE6BA28632B552074C8A05968ED49" Guid="*">
<File Id="filB29D13A0412832DF84301430FAF5C2EB" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\AzureRM.Tags.psd1" />
</Component>
<Component Id="cmp5387447D3AEFB20D850B31BB0324D032" Guid="*">
<File Id="fil96612AEDAC40E485D577E1BB70E1777F" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\CdnStartup.ps1" />
</Component>
<Component Id="cmpFCC54BA077C7C12B0A49F42DD3039435" Guid="*">
<File Id="filD253995C681D155F4A3BAED9AC075F4D" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Cdn\Hyak.Common.dll" />
</Component>
Expand Down Expand Up @@ -5033,7 +5033,6 @@
<ComponentRef Id="cmpFDFB38E21048DD505BCAD31F5136992E" />
<ComponentRef Id="cmpC2439F65706917CA4AABD3AF6AFB856A" />
<ComponentRef Id="cmp048B605B1072F4A5467F2AFFD8ED2459" />
<ComponentRef Id="cmpB2F2FF5F057BDE656891B43C18ADF020" />
<ComponentRef Id="cmp889E4CFA9046EFFEFF5D63CB61E990A6" />
<ComponentRef Id="cmpA2F17B479BD0FE1A81AED68A6C03B7A0" />
<ComponentRef Id="cmp4E983C9ECBC2D4A29376A70418BE5E2B" />
Expand Down Expand Up @@ -5131,6 +5130,7 @@
<ComponentRef Id="cmp22BC5873E0018F5801CD486C6CBCE0C5" />
<ComponentRef Id="cmpB7108FC1E0DA3A2DABE2F5A549025C62" />
<ComponentRef Id="cmp87DFE6BA28632B552074C8A05968ED49" />
<ComponentRef Id="cmp5387447D3AEFB20D850B31BB0324D032" />
<ComponentRef Id="cmpFCC54BA077C7C12B0A49F42DD3039435" />
<ComponentRef Id="cmp984FE30B4A873A5B1BC8F7E85B1CEF85" />
<ComponentRef Id="cmp2F3E4B9B10BAC8DA1FA711C6B756E1D1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function Test-CustomDomainGetRemoveWithRunningEndpoint
$createdEndpoint = New-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName

$endpoint = Get-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
$validateResult = Validate-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
$validateResult = Test-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
Assert-True{$validateResult.CustomDomainValidated}
$validateResultbyPiping = Validate-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName $hostName
$validateResultbyPiping = Test-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName $hostName
Assert-True{$validateResultbyPiping.CustomDomainValidated}

$createdCustomDomain = New-AzureRmCdnCustomDomain -HostName $hostName -CustomDomainName $customDomainName -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
Expand Down Expand Up @@ -77,9 +77,9 @@ function Test-CustomDomainGetRemoveWithStoppedEndpoint
$createdEndpoint = New-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Location $resourceLocation -OriginName $originName -OriginHostName $originHostName

$endpoint = Get-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName
$validateResult = Validate-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
$validateResult = Test-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName $hostName
Assert-True{$validateResult.CustomDomainValidated}
$validateResultbyPiping = Validate-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName $hostName
$validateResultbyPiping = Test-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName $hostName
Assert-True{$validateResultbyPiping.CustomDomainValidated}

$stopped = Stop-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Test-EndpointCrudAndAction
$loaded = Publish-AzureRmCdnEndpointContent -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -LoadContent @("/pic1.jpg", "/pic2.jpg") -PassThru
Assert-True{$loaded}

$validateResult = Validate-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName "unverifiedcustomdomain.com"
$validateResult = Test-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName "unverifiedcustomdomain.com"
Assert-False{$validateResult.CustomDomainValidated}

$endpointRemoved = Remove-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false -PassThru
Expand Down Expand Up @@ -113,7 +113,7 @@ function Test-EndpointCrudAndActionWithPiping
$loaded = Publish-AzureRmCdnEndpointContent -CdnEndpoint $createdEndpoint -LoadContent @("/pic1.jpg", "/pic2.jpg") -PassThru
Assert-True{$loaded}

$validateResultbyPiping = Validate-AzureRmCdnCustomDomain -CdnEndpoint $createdEndpoint -CustomDomainHostName "unverifiedcustomdomain.com"
$validateResultbyPiping = Test-AzureRmCdnCustomDomain -CdnEndpoint $createdEndpoint -CustomDomainHostName "unverifiedcustomdomain.com"
Assert-False{$validateResultbyPiping.CustomDomainValidated}

$startedEndpoint.OriginHostHeader = "www.microsoft.com"
Expand Down Expand Up @@ -201,7 +201,7 @@ function Test-EndpointCrudAndActionWithAllProperties
$loaded = Publish-AzureRmCdnEndpointContent -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -LoadContent @("/pic1.jpg", "/pic2.jpg") -PassThru
Assert-True{$loaded}

$validateResult = Validate-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName "unverifiedcustomdomain.com"
$validateResult = Test-AzureRmCdnCustomDomain -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -CustomDomainHostName "unverifiedcustomdomain.com"
Assert-False{$validateResult.CustomDomainValidated}

$endpointRemoved = Remove-AzureRmCdnEndpoint -EndpointName $endpointName -ProfileName $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -Confirm:$false -PassThru
Expand Down Expand Up @@ -337,7 +337,7 @@ function Test-EndpointCrudAndActionWithStoppedEndpoint
$loaded = Publish-AzureRmCdnEndpointContent -CdnEndpoint $createdEndpoint -LoadContent @("/pic1.jpg", "/pic2.jpg") -PassThru
Assert-True{$loaded}

$validateResultbyPiping = Validate-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName "unverifiedcustomdomain.com"
$validateResultbyPiping = Test-AzureRmCdnCustomDomain -CdnEndpoint $endpoint -CustomDomainHostName "unverifiedcustomdomain.com"
Assert-False{$validateResultbyPiping.CustomDomainValidated}

$startedEndpoint.OriginHostHeader = "www.microsoft.com"
Expand Down
17 changes: 17 additions & 0 deletions src/ResourceManager/Cdn/Commands.Cdn/CdnStartup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

@{
"Validate-AzureRmCdnCustomDomain" = "Test-AzureRmCdnCustomDomain";
}.GetEnumerator() | Select @{Name='Name'; Expression={$_.Key}}, @{Name='Value'; Expression={$_.Value}} | New-Alias -Description "AzureAlias"
7 changes: 5 additions & 2 deletions src/ResourceManager/Cdn/Commands.Cdn/Commands.Cdn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<Compile Include="Endpoint\SetAzureRmCdnEndpoint.cs" />
<Compile Include="Endpoint\StartAzureRmCdnEndpoint.cs" />
<Compile Include="Endpoint\StopAzureRmCdnEndpoint.cs" />
<Compile Include="Endpoint\ValidateAzureRmCdnCustomDomain.cs" />
<Compile Include="Endpoint\TestAzureRmCdnCustomDomain.cs" />
<Compile Include="Helpers\ModelExtensions.cs" />
<Compile Include="Models\CustomDomain\PSCustomDomain.cs" />
<Compile Include="Models\CustomDomain\PSCustomDomainResourceState.cs" />
Expand Down Expand Up @@ -169,7 +169,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\AzureRM.Cdn.psd1">
<None Include="..\AzureRM.Cdn.psd1">
<Link>AzureRM.Cdn.psd1</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand All @@ -178,6 +178,9 @@
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="CdnStartup.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@
// ----------------------------------------------------------------------------------

using System;
using System.IO;
using System.Management.Automation;
using System.Net;
using System.Reflection;
using Microsoft.Azure.Commands.Cdn.Common;
using Microsoft.Azure.Commands.Cdn.Helpers;
using Microsoft.Azure.Commands.Cdn.Models.CustomDomain;
using Microsoft.Azure.Commands.Cdn.Properties;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Management.Cdn;
using Microsoft.Azure.Management.Cdn.Models;

namespace Microsoft.Azure.Commands.Cdn.CustomDomain
{
[Cmdlet(VerbsCommon.New, "AzureRmCdnCustomDomain"), OutputType(typeof(PSCustomDomain))]
public class NewAzureRmCdnCustomDomain : AzureCdnCmdletBase
public class NewAzureRmCdnCustomDomain : AzureCdnCmdletBase, IModuleAssemblyInitializer
{
[Parameter(Mandatory = true, HelpMessage = "Host name of the Azure Cdn CustomDomain name.")]
[ValidateNotNullOrEmpty]
Expand Down Expand Up @@ -90,5 +93,15 @@ public override void ExecuteCmdlet()
}
}
}

public void OnImport()
{
System.Management.Automation.PowerShell invoker = null;
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
"CdnStartup.ps1")));
invoker.Invoke();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

namespace Microsoft.Azure.Commands.Cdn.Endpoint
{
[Cmdlet("Validate", "AzureRmCdnCustomDomain"), OutputType(typeof(PSValidateCustomDomainOutput))]
public class ValidateAzureRmCdnCustomDomain : AzureCdnCmdletBase
[Cmdlet(VerbsDiagnostic.Test, "AzureRmCdnCustomDomain"), OutputType(typeof(PSValidateCustomDomainOutput))]
public class TestAzureRmCdnCustomDomain : AzureCdnCmdletBase
{
[Parameter(Mandatory = true, ParameterSetName = FieldsParameterSet, HelpMessage = "Azure Cdn endpoint name.")]
[ValidateNotNullOrEmpty]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3463,7 +3463,7 @@
<command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
<!--Generated by PS Cmdlet Help Editor-->
<command:details>
<command:name>Validate-AzureRmCdnCustomDomain</command:name>
<command:name>Test-AzureRmCdnCustomDomain</command:name>
<maml:description>
<maml:para>Validate the custom domain</maml:para>
</maml:description>
Expand All @@ -3479,7 +3479,7 @@
</maml:description>
<command:syntax>
<command:syntaxItem>
<maml:name>Validate-AzureRmCdnCustomDomain</maml:name>
<maml:name>Test-AzureRmCdnCustomDomain</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>EndpointName</maml:name>
<maml:description>
Expand Down Expand Up @@ -3524,7 +3524,7 @@
</command:parameter>
</command:syntaxItem>
<command:syntaxItem>
<maml:name>Validate-AzureRmCdnCustomDomain</maml:name>
<maml:name>Test-AzureRmCdnCustomDomain</maml:name>
<command:parameter required="true" variableLength="false" globbing="false" pipelineInput="true (ByValue)" position="named">
<maml:name>CdnEndpoint</maml:name>
<maml:description>
Expand Down
3 changes: 3 additions & 0 deletions tools/AzureRM/AzureRM.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

@{

#Base module
RootModule = '.\AzureRM.psm1'

# Version number of this module.
ModuleVersion = '1.3.0'

Expand Down
94 changes: 94 additions & 0 deletions tools/AzureRM/AzureRM.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@



<#
.Synopsis
DEPRECATED - Installing the AzureRM installs all AzureRM cmdlets.

.Description
DEPRECATED - Installing the AzureRM installs all AzureRM cmdlets.

.Parameter MajorVersion
DEPRECATED -Specifies the major version.

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

.Parameter Scope
DEPRECATED - Specifies the parameter scope.

.Parameter Force
DEPRECATED - Force download and installation of modules already installed.
#>
function Update-AzureRM
{

param(
[Parameter(Position=0, Mandatory = $false)]
[string]
$MajorVersion,
[Parameter(Position=1, Mandatory = $false)]
[string]
$Repository = "PSGallery",
[Parameter(Position=2, Mandatory = $false)]
[ValidateSet("CurrentUser","AllUsers")]
[string]
$Scope = "AllUsers",
[switch]
$Force = $false)


Write-Output "DEPRECATED - This cmdlet is no longer necessary - installing the AzureRM module installs all AzureRM cmdlets."


}

<#
.Synopsis
DEPRECATED - If using WMF5, you can run Import-Module AzureRM to load all AzureRM modules.

.Description
DEPRECATED - If using WMF5, you can run Import-Module AzureRM to load all AzureRM modules.

.Parameter MajorVersion
DEPRECATED - Specifies the major version.
#>
function Import-AzureRM
{
param(
[Parameter(Position=0, Mandatory = $false)]
[string]
$MajorVersion )
Write-Output "DEPRECATED - If using Windows Management Framework 5, you can load all modules using 'Import-Module AzureRM'."


}



<#
.Synopsis
DEPRECATED - please uninstall each module using 'Uninstall-Module Azure* -Force'

.Description
DEPRECATED - this cmdlet has no effect on installed modules

.Parameter MajorVersion
DEPRECATED - Specifies the major version.
#>
function Uninstall-AzureRM
{
param(
[Parameter(Position=0, Mandatory = $false)]
[string]
$MinVersion)



Write-Output "DEPRECATED - to uninstall azure modules, run 'Uninstall-Module AzureRm', then 'Uninstall-Module Azure* -Force'"


}

New-Alias -Name Install-AzureRM -Value Update-AzureRM
Export-ModuleMember -function Uninstall-AzureRM, Update-AzureRM, Import-AzureRM -Alias Install-AzureRM