Skip to content

New cmdlets to create/enter PSSession in remote container app. New cmdlet for getting container continuous deployment url #7231

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

Closed
wants to merge 7 commits into from
Closed
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,40 +1,4 @@
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------

using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Microsoft.Azure.Commands.Profile.AzureRmAlias
{
public class Mappings
{
public static Dictionary<string, object> GetCaseInsensitiveMapping()
{
string jsonmapping = jsonMappings;
Dictionary<string, object> caseSensitiveMapping = (Dictionary<string, object>)JsonConvert.DeserializeObject(jsonmapping, typeof(Dictionary<string, object>));
var mapping = new Dictionary<string, object>(StringComparer.CurrentCultureIgnoreCase);
foreach (var key in caseSensitiveMapping.Keys)
{
mapping.Add(key, caseSensitiveMapping[key]);
}

return mapping;
}

public static string jsonMappings = @"
{
{
'Az.ApiManagement': {
'Add-AzApiManagementProductToGroup': 'Add-AzureRmApiManagementProductToGroup',
'Get-AzApiManagementOperation': 'Get-AzureRmApiManagementOperation',
Expand Down Expand Up @@ -1210,7 +1174,6 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Remove-AzStorageFile': 'Remove-AzureStorageFile',
'Set-AzCurrentStorageAccount': 'Set-AzureRmCurrentStorageAccount',
'Get-AzStorageUsage': 'Get-AzureRmStorageUsage',
'Enable-AzStorageStaticWebsite': 'Enable-AzureStorageStaticWebsite',
'Get-AzStorageQueue': 'Get-AzureStorageQueue',
'Enable-AzStorageDeleteRetentionPolicy': 'Enable-AzureStorageDeleteRetentionPolicy',
'Update-AzStorageServiceProperty': 'Update-AzureStorageServiceProperty',
Expand Down Expand Up @@ -1266,7 +1229,6 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Remove-AzStorageAccount': 'Remove-AzureRmStorageAccount',
'Get-AzStorageServiceMetricsProperty': 'Get-AzureStorageServiceMetricsProperty',
'New-AzStorageContainerStoredAccessPolicy': 'New-AzureStorageContainerStoredAccessPolicy',
'Disable-AzStorageStaticWebsite': 'Disable-AzureStorageStaticWebsite',
'Lock-AzRmStorageContainerImmutabilityPolicy': 'Lock-AzureRmStorageContainerImmutabilityPolicy',
'Add-AzRmStorageContainerLegalHold': 'Add-AzureRmStorageContainerLegalHold',
'Remove-AzStorageBlob': 'Remove-AzureStorageBlob',
Expand Down Expand Up @@ -1464,6 +1426,7 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Switch-AzWebAppSlot': 'Switch-AzureRmWebAppSlot',
'Get-AzAppServicePlanMetrics': 'Get-AzureRmAppServicePlanMetrics',
'Get-AzAppServicePlan': 'Get-AzureRmAppServicePlan',
'Enter-AzWebAppContainerPSSession': 'Enter-AzureRmWebAppContainerPSSession',
'New-AzAppServicePlan': 'New-AzureRmAppServicePlan',
'Get-AzWebAppSlot': 'Get-AzureRmWebAppSlot',
'Reset-AzWebAppSlotPublishingProfile': 'Reset-AzureRmWebAppSlotPublishingProfile',
Expand All @@ -1473,6 +1436,7 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Restore-AzWebAppBackup': 'Restore-AzureRmWebAppBackup',
'New-AzWebAppDatabaseBackupSetting': 'New-AzureRmWebAppDatabaseBackupSetting',
'New-AzWebApp': 'New-AzureRmWebApp',
'Get-AzWebAppContainerContinuousDeploymentUrl': 'Get-AzureRMWebAppContainerContinuousDeploymentUrl',
'Remove-AzWebApp': 'Remove-AzureRmWebApp',
'Get-AzWebAppMetrics': 'Get-AzureRmWebAppMetrics',
'Get-AzWebAppSSLBinding': 'Get-AzureRmWebAppSSLBinding',
Expand All @@ -1485,6 +1449,7 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Edit-AzWebAppBackupConfiguration': 'Edit-AzureRmWebAppBackupConfiguration',
'Restart-AzWebApp': 'Restart-AzureRmWebApp',
'Stop-AzWebApp': 'Stop-AzureRmWebApp',
'New-AzWebAppContainerPSSession': 'New-AzureRmWebAppContainerPSSession',
'Stop-AzWebAppSlot': 'Stop-AzureRmWebAppSlot'
},
'Az.StorageSync': {
Expand Down Expand Up @@ -1829,14 +1794,18 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
},
'Az.IotHub': {
'Get-AzIotHubValidSku': 'Get-AzureRmIotHubValidSku',
'Test-AzIotHubRoute': 'Test-AzureRmIotHubRoute',
'Get-AzIotHub': 'Get-AzureRmIotHub',
'Get-AzIotHubKey': 'Get-AzureRmIotHubKey',
'Add-AzIotHubRoutingEndpoint': 'Add-AzureRmIotHubRoutingEndpoint',
'Add-AzIotHubKey': 'Add-AzureRmIotHubKey',
'Set-AzIotHubVC': 'Set-AzureRmIotHubVC',
'Remove-AzIotHubCertificate': 'Remove-AzureRmIotHubCertificate',
'Set-AzIotHub': 'Set-AzureRmIotHub',
'Get-AzIotHubRoutingEndpoint': 'Get-AzureRmIotHubRoutingEndpoint',
'Remove-AzIotHubEventHubConsumerGroup': 'Remove-AzureRmIotHubEventHubConsumerGroup',
'Get-AzIotHubEventHubConsumerGroup': 'Get-AzureRmIotHubEventHubConsumerGroup',
'Remove-AzIotHubRoutingEndpoint': 'Remove-AzureRmIotHubRoutingEndpoint',
'Get-AzIotHubCertificate': 'Get-AzureRmIotHubCertificate',
'Get-AzIotHubQuotaMetric': 'Get-AzureRmIotHubQuotaMetric',
'Add-AzIotHubCertificate': 'Add-AzureRmIotHubCertificate',
Expand All @@ -1851,11 +1820,15 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'New-AzIotHubImportDevices': 'New-AzureRmIotHubImportDevices',
'New-AzIotHubExportDevices': 'New-AzureRmIotHubExportDevices',
'Remove-AzIotHubEHCG': 'Remove-AzureRmIotHubEHCG',
'Remove-AzIotHubRoute': 'Remove-AzureRmIotHubRoute',
'Add-AzIotHubRoute': 'Add-AzureRmIotHubRoute',
'Get-AzIotHubRoute': 'Get-AzureRmIotHubRoute',
'Get-AzIotHubCVC': 'Get-AzureRmIotHubCVC',
'Get-AzIotHubRegistryStatistic': 'Get-AzureRmIotHubRegistryStatistic',
'Get-AzIotHubConnectionString': 'Get-AzureRmIotHubConnectionString',
'Get-AzIotHubEHCG': 'Get-AzureRmIotHubEHCG',
'Remove-AzIotHub': 'Remove-AzureRmIotHub'
'Remove-AzIotHub': 'Remove-AzureRmIotHub',
'Set-AzIotHubRoute': 'Set-AzureRmIotHubRoute'
},
'Az.Resources': {
'Remove-AzPolicySetDefinition': 'Remove-AzureRmPolicySetDefinition',
Expand Down Expand Up @@ -2349,7 +2322,3 @@ public static Dictionary<string, object> GetCaseInsensitiveMapping()
'Remove-AzApplicationInsightsContinuousExport': 'Remove-AzureRmApplicationInsightsContinuousExport'
}
}
";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlan.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlanHyperV.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.AppServicePlanTests\TestCreateNewAppServicePlanInAse.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -176,9 +179,15 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebAppHyperV.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestCreateNewWebAppSimple.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestEnableContainerContiniousDeploymentAndGetUrl.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests\TestRemoveWebApp.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public void TestCreateNewAppServicePlan()
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlan");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewAppServicePlanHyperV()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanHyperV");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSetAppServicePlan()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,56 @@ function Test-CreateNewAppServicePlan
}
}

<#
.SYNOPSIS
Tests creating a new Web Hosting Plan with HyperV container.
#>
function Test-CreateNewAppServicePlanHyperV
{
# Setup
$rgname = Get-ResourceGroupName
$whpName = Get-WebHostPlanName
$location = Get-Location
$capacity = 1
$skuName = "PC2"
$tier = "PremiumContainer"

try
{
#Setup
New-AzureRmResourceGroup -Name $rgname -Location $location

# Test
$job = New-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -HyperV -AsJob
$job | Wait-Job
$createResult = $job | Receive-Job

# Assert
Assert-AreEqual $whpName $createResult.Name
Assert-AreEqual $tier $createResult.Sku.Tier
Assert-AreEqual $skuName $createResult.Sku.Name
Assert-AreEqual $capacity $createResult.Sku.Capacity

# Assert

$getResult = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName
Assert-AreEqual $whpName $getResult.Name
Assert-AreEqual PremiumContainer $getResult.Sku.Tier
Assert-AreEqual $skuName $getResult.Sku.Name
Assert-AreEqual $capacity $getResult.Sku.Capacity
Assert-AreEqual $true $getResult.IsXenon
Assert-AreEqual "xenon" $getResult.Kind

}
finally
{
# Cleanup
Remove-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force
Remove-AzureRmResourceGroup -Name $rgname -Force
}
}


<#
.SYNOPSIS
Tests creating a new Web Hosting Plan.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ public void TestCreateNewWebApp()
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebApp");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppHyperV()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewWebAppHyperV");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestEnableContainerContiniousDeploymentAndGetUrl()
{
WebsitesController.NewInstance.RunPsTest(_logger, "Test-EnableContainerContiniousDeploymentAndGetUrl");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewAppOnAse()
Expand Down
Loading