From 41ebd3080ae74264c14f4e01862d90e13942e0ba Mon Sep 17 00:00:00 2001 From: Theja K Date: Fri, 5 Jun 2020 08:49:30 +0530 Subject: [PATCH 1/2] Linux Changes#5983 --- .../ScenarioTests/AppServicePlanTests.cs | 7 +++ .../ScenarioTests/AppServicePlanTests.ps1 | 50 ++++++++++++++++++- src/Websites/Websites.sln | 4 +- src/Websites/Websites/ChangeLog.md | 1 + .../AppServicePlans/NewAzureAppServicePlan.cs | 6 ++- src/Websites/Websites/Websites.csproj | 1 + .../Websites/help/New-AzAppServicePlan.md | 22 ++++++-- 7 files changed, 84 insertions(+), 7 deletions(-) diff --git a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs index 3ed73ac1bd84..25c596e4823c 100644 --- a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs +++ b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.cs @@ -45,6 +45,13 @@ public void TestCreateNewAppServicePlanHyperV() WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanHyperV"); } + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestCreateNewAppServicePlanLinux() + { + WebsitesController.NewInstance.RunPsTest(_logger, "Test-CreateNewAppServicePlanLinux"); + } + [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSetAppServicePlan() diff --git a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1 b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1 index 760e773aa0d3..b0c83374563d 100644 --- a/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1 +++ b/src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1 @@ -57,7 +57,6 @@ function Test-CreateNewAppServicePlan Remove-AzResourceGroup -Name $rgname -Force } } - <# .SYNOPSIS Tests creating a new Web Hosting Plan with HyperV container. @@ -108,6 +107,55 @@ function Test-CreateNewAppServicePlanHyperV } +<# +.SYNOPSIS +Tests creating a new Web Hosting Plan with Linux +#> +function Test-CreateNewAppServicePlanLinux +{ + # Setup + $rgname = Get-ResourceGroupName + $whpName = Get-WebHostPlanName + $location = Get-Location + $capacity = 1 + $skuName = "B1" + $tier = "Basic" + + try + { + #Setup + New-AzResourceGroup -Name $rgname -Location $location + + # Test + $job = New-AzAppServicePlan -ResourceGroupName $rgname -Name $whpName -Location $location -Tier $tier -WorkerSize Small -Linux -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-AzAppServicePlan -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.Reserved + Assert-AreEqual "Linux" $getResult.Kind + + } + finally + { + # Cleanup + Remove-AzAppServicePlan -ResourceGroupName $rgname -Name $whpName -Force + Remove-AzResourceGroup -Name $rgname -Force + } +} + <# .SYNOPSIS Tests creating a new Web Hosting Plan. diff --git a/src/Websites/Websites.sln b/src/Websites/Websites.sln index b8cdd1848e89..7ca4fcc30841 100644 --- a/src/Websites/Websites.sln +++ b/src/Websites/Websites.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2042 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30002.166 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Websites", "Websites\Websites.csproj", "{80A92297-7C92-456B-8EE7-9FB6CE30149D}" EndProject diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index e918c5d41fdf..9ccecd9f9bd9 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -19,6 +19,7 @@ --> ## Upcoming Release * Added "SourceWebApp.Location" for `New-AzWebApp` and `New-AzWebAppSlot` +* Added Linux support parameter for New-AzAppServicePlan ## Version 1.9.0 * Fixed typo on help of `Update-AzWebAppAccessRestrictionConfig`. diff --git a/src/Websites/Websites/Cmdlets/AppServicePlans/NewAzureAppServicePlan.cs b/src/Websites/Websites/Cmdlets/AppServicePlans/NewAzureAppServicePlan.cs index ef5aa5a3da4a..4200c6f1ba8c 100644 --- a/src/Websites/Websites/Cmdlets/AppServicePlans/NewAzureAppServicePlan.cs +++ b/src/Websites/Websites/Cmdlets/AppServicePlans/NewAzureAppServicePlan.cs @@ -68,6 +68,9 @@ public class NewAzureAppServicePlanCmdlet : AppServicePlanBaseCmdlet [Parameter(ParameterSetName = ParameterSet1Name, Mandatory = false, HelpMessage = "Tags are name/value pairs that enable you to categorize resources")] public Hashtable Tag { get; set; } + [Parameter(ParameterSetName = ParameterSet1Name, Mandatory = false)] + public SwitchParameter Linux { get; set; } + public override void ExecuteCmdlet() { if (HyperV.IsPresent && Tier != "PremiumContainer") @@ -113,7 +116,8 @@ public override void ExecuteCmdlet() Sku = sku, PerSiteScaling = PerSiteScaling, IsXenon = HyperV.IsPresent, - Tags= (IDictionary)CmdletHelpers.ConvertToStringDictionary(Tag) + Tags= (IDictionary)CmdletHelpers.ConvertToStringDictionary(Tag), + Reserved = Linux.IsPresent }; AppServicePlan retPlan = WebsitesClient.CreateOrUpdateAppServicePlan(ResourceGroupName, Name, appServicePlan, AseName, aseResourceGroupName); diff --git a/src/Websites/Websites/Websites.csproj b/src/Websites/Websites/Websites.csproj index 101d911e37d4..037e2f0948b2 100644 --- a/src/Websites/Websites/Websites.csproj +++ b/src/Websites/Websites/Websites.csproj @@ -8,6 +8,7 @@ $(LegacyAssemblyPrefix)WebApps + netstandard2.0 diff --git a/src/Websites/Websites/help/New-AzAppServicePlan.md b/src/Websites/Websites/help/New-AzAppServicePlan.md index 015d257e781f..5bf3164b7866 100644 --- a/src/Websites/Websites/help/New-AzAppServicePlan.md +++ b/src/Websites/Websites/help/New-AzAppServicePlan.md @@ -16,9 +16,9 @@ Creates an Azure App Service plan in a given Geo location. ### S1 ``` New-AzAppServicePlan [-Location] [[-Tier] ] [[-NumberofWorkers] ] - [[-WorkerSize] ] [[-AseName] ] [[-AseResourceGroupName] ] [-PerSiteScaling ] - [-HyperV] [-AsJob] [-ResourceGroupName] [-Name] [-DefaultProfile ] - [] + [[-WorkerSize] ] [[-AseName] ] [[-AseResourceGroupName] ] [-PerSiteScaling ] + [-HyperV] [-Linux] [-AsJob] [-ResourceGroupName] [-Name] [-DefaultProfile ] + [] ``` ### S2 @@ -133,6 +133,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` + +### -Linux +Specify this, App Service Plan will run Linux Contaianers + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: S1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Location Location From 5118c99ae5b73fa5b6ea2cfb12a88231101f6835 Mon Sep 17 00:00:00 2001 From: Yabo Hu Date: Mon, 8 Jun 2020 11:25:48 +0800 Subject: [PATCH 2/2] Update ChangeLog.md --- src/Websites/Websites/ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Websites/Websites/ChangeLog.md b/src/Websites/Websites/ChangeLog.md index 9ccecd9f9bd9..97a4dd8d3a96 100644 --- a/src/Websites/Websites/ChangeLog.md +++ b/src/Websites/Websites/ChangeLog.md @@ -18,8 +18,8 @@ - Additional information about change #1 --> ## Upcoming Release -* Added "SourceWebApp.Location" for `New-AzWebApp` and `New-AzWebAppSlot` * Added Linux support parameter for New-AzAppServicePlan +* Added "SourceWebApp.Location" for `New-AzWebApp` and `New-AzWebAppSlot` ## Version 1.9.0 * Fixed typo on help of `Update-AzWebAppAccessRestrictionConfig`.