Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
50 changes: 49 additions & 1 deletion src/Websites/Websites.Test/ScenarioTests/AppServicePlanTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function Test-CreateNewAppServicePlan
Remove-AzResourceGroup -Name $rgname -Force
}
}

<#
.SYNOPSIS
Tests creating a new Web Hosting Plan with HyperV container.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/Websites/Websites.sln
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions src/Websites/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added Linux support parameter for New-AzAppServicePlan
* Added "SourceWebApp.Location" for `New-AzWebApp` and `New-AzWebAppSlot`

## Version 1.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -113,7 +116,8 @@ public override void ExecuteCmdlet()
Sku = sku,
PerSiteScaling = PerSiteScaling,
IsXenon = HyperV.IsPresent,
Tags= (IDictionary<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag)
Tags= (IDictionary<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag),
Reserved = Linux.IsPresent
};

AppServicePlan retPlan = WebsitesClient.CreateOrUpdateAppServicePlan(ResourceGroupName, Name, appServicePlan, AseName, aseResourceGroupName);
Expand Down
1 change: 1 addition & 0 deletions src/Websites/Websites/Websites.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<PropertyGroup>
<RootNamespace>$(LegacyAssemblyPrefix)WebApps</RootNamespace>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
22 changes: 19 additions & 3 deletions src/Websites/Websites/help/New-AzAppServicePlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Creates an Azure App Service plan in a given Geo location.
### S1
```
New-AzAppServicePlan [-Location] <String> [[-Tier] <String>] [[-NumberofWorkers] <Int32>]
[[-WorkerSize] <String>] [[-AseName] <String>] [[-AseResourceGroupName] <String>] [-PerSiteScaling <Boolean>]
[-HyperV] [-AsJob] [-ResourceGroupName] <String> [-Name] <String> [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
[[-WorkerSize] <String>] [[-AseName] <String>] [[-AseResourceGroupName] <String>] [-PerSiteScaling <Boolean>]
[-HyperV] [-Linux] [-AsJob] [-ResourceGroupName] <String> [-Name] <String> [-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
```

### S2
Expand Down Expand Up @@ -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

Expand Down