Skip to content

Commit

Permalink
[AppService]: fix #21399 - [New-AzWebApp] -Tag parameter not availabl…
Browse files Browse the repository at this point in the history
…e in all ParameterSets (#21447)
  • Loading branch information
Kotasudhakarreddy authored Apr 6, 2023
1 parent f37ea19 commit 00a65e5
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 115 deletions.
5 changes: 4 additions & 1 deletion src/Websites/Websites.Test/ScenarioTests/WebAppTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1153,19 +1153,22 @@ function Test-CreateNewWebAppOnAse
$whpName = "ASP-PS-UnitTesting"
$aseName = "ASE-PS-Unittesting"
$resourceType = "Microsoft.Web/sites"
$tag= @{"TagKey" = "TagValue"}
try
{
#Setup
$serverFarm = Get-AzAppServicePlan -ResourceGroupName $rgname -Name $whpName

# Create new web app
$job = New-AzWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -AseName $aseName -AsJob
$job = New-AzWebApp -ResourceGroupName $rgname -Name $wname -Location $location -AppServicePlan $whpName -AseName $aseName -Tag $tag -AsJob
$job | Wait-Job
$actual = $job | Receive-Job

# Assert
Assert-AreEqual $wname $actual.Name
Assert-AreEqual $serverFarm.Id $actual.ServerFarmId
Assert-AreEqual $tag.Keys $actual.Tags.Keys
Assert-AreEqual $tag.Values $actual.Tags.Values

# Get new web app
$result = Get-AzWebApp -ResourceGroupName $rgname -Name $wname
Expand Down

Large diffs are not rendered by default.

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
* Fixed Tag parameter issues with ASE for `New-AzWebApp`

## Version 2.14.0
* Fixed `Edit-AzWebAppBackupConfiguration` to pass backup configuration enabled or not
Expand Down
4 changes: 2 additions & 2 deletions src/Websites/Websites/Cmdlets/WebApps/NewAzureWebApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class NewAzureWebAppCmdlet : WebAppBaseClientCmdLet
[Parameter(Mandatory = false, HelpMessage = "Path to the GitHub repository containign the web application to deploy.", ParameterSetName = SimpleParameterSet)]
public string GitRepositoryPath { get; set; }

[Parameter(Mandatory = false, HelpMessage = "Tags are name/value pairs that enable you to categorize resources", ParameterSetName = SimpleParameterSet)]
[Parameter(Mandatory = false, HelpMessage = "Tags are name/value pairs that enable you to categorize resources")]
public Hashtable Tag { get; set; }

protected override void ProcessRecord()
Expand Down Expand Up @@ -236,7 +236,7 @@ public void CreateWithClonedWebApp()

try
{
WriteObject(new PSSite(WebsitesClient.CreateWebApp(ResourceGroupName, Name, null, Location, AppServicePlan, cloningInfo, AseName, AseResourceGroupName)));
WriteObject(new PSSite(WebsitesClient.CreateWebApp(ResourceGroupName, Name, null, Location, AppServicePlan, cloningInfo, AseName, AseResourceGroupName, (IDictionary<string, string>)CmdletHelpers.ConvertToStringDictionary(Tag))));
}
catch (Exception e)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Websites/Websites/help/New-AzWebApp.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ New-AzWebApp [[-ResourceGroupName] <String>] [-Name] <String> [[-Location] <Stri
### PrivateRegistry
```
New-AzWebApp [-ResourceGroupName] <String> [-Name] <String> [[-Location] <String>] [[-AppServicePlan] <String>]
-ContainerImageName <String> -ContainerRegistryUrl <String> -ContainerRegistryUser <String>
-ContainerImageName <String> -ContainerRegistryUrl <String> -ContainerRegistryUser <String> [-Tag <Hashtable>]
-ContainerRegistryPassword <SecureString> [-EnableContainerContinuousDeployment] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```
Expand All @@ -34,7 +34,7 @@ New-AzWebApp [-ResourceGroupName] <String> [-Name] <String> [[-Location] <String
New-AzWebApp [-ResourceGroupName] <String> [-Name] <String> [-Location] <String> [[-AppServicePlan] <String>]
[[-SourceWebApp] <PSSite>] [[-TrafficManagerProfile] <String>] [-EnableContainerContinuousDeployment]
[-IgnoreSourceControl] [-IgnoreCustomHostNames] [[-AppSettingsOverrides] <Hashtable>] [[-AseName] <String>]
[[-AseResourceGroupName] <String>] [-IncludeSourceWebAppSlots] [-AsJob]
[[-AseResourceGroupName] <String>] [-IncludeSourceWebAppSlots] [-AsJob] [-Tag <Hashtable>]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

Expand Down Expand Up @@ -383,7 +383,7 @@ Tags are name/value pairs that enable you to categorize resources
```yaml
Type: System.Collections.Hashtable
Parameter Sets: SimpleParameterSet
Parameter Sets: (All)
Aliases:

Required: False
Expand Down

0 comments on commit 00a65e5

Please sign in to comment.