Skip to content
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

[AppService]: Feature #19496 Added -Tag parameter support to New-AzWebApp & New-AzWebAppSlot #20019

Merged
merged 8 commits into from
Nov 8, 2022
Merged

Conversation

Kotasudhakarreddy
Copy link
Contributor

…pSlot

#19496

Description

In my organisation we are required to add tags for every Azure resource. The mentioned cmdlet doesn't have a -Tag parameter which effectively prevents me from creating a resource. Ont he other hand Azure Portal also doesn't allow me to supply the tag upon creation.

Checklist

  • SHOULD select appropriate branch. Cmdlets from Autorest.PowerShell should go to generation branch.
  • SHOULD make the title of PR clear and informative, and in the present imperative tense.
  • SHOULD update ChangeLog.md file(s) appropriately
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense. Add changelog in description section if PR goes into generation branch.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD have approved design review for the changes in this repository (Microsoft internal only) with following situations
    • Create new module from scratch
    • Create new resource types which are not easy to conform to Azure PowerShell Design Guidelines
    • Create new resource type which name doesn't use module name as prefix
    • Have design question before implementation
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT introduce breaking changes in Az minor release except preview version.
  • SHOULD NOT adjust version of module manually in pull request

@Nickcandy
Copy link
Contributor

It looks good to me except the indentation. Please help me double-check @BethanyZhou

Copy link
Contributor

@BethanyZhou BethanyZhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@BethanyZhou
Copy link
Contributor

/azp run azure-powershell - security-tools

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

@Nickcandy Nickcandy merged commit eed22af into Azure:main Nov 8, 2022
@Poolshark314
Copy link

Poolshark314 commented Mar 28, 2023

I am running Az 9.5 and I see the -Tag parameter in the documentation, but the command is failing when attempting to pass a hashtable to it. Is this not completed yet?

$webApp = New-AzWebApp -Name $sitename -ResourceGroupName $RGName -Location $location -AseResourceGroupName $aserg -AseName $asename -AppServicePlan $aspID -Tag $VMTags

results in:
`New-AzWebApp : Parameter set cannot be resolved using the specified named parameters.
At line:84 char:11

  • $webApp = New-AzWebApp -Name $sitename -ResourceGroupName $RGName -Lo ...
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [New-AzWebApp], ParameterBindingException
    • FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.NewAzureWebAppCmdlet`

Dropping the -Tag argument from the command allows it to complete successfully

@BethanyZhou
Copy link
Contributor

Hi @Poolshark314 , could you append -Debug at the end of your command and paste the debug message here?

@Poolshark314
Copy link

@BethanyZhou Unfortunately the output looks the same when run with -Debug:

New-AzWebApp : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:11

  • $webApp = New-AzWebApp -Name $sitename -ResourceGroupName $RGName -Lo ...
  •       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [New-AzWebApp], ParameterBindingException
    • FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps.NewAzureWebAppCmdlet

@BethanyZhou
Copy link
Contributor

Hi @Poolshark314 , checked the syntax of New-AzWebApp, I find -Tag only exists in the first parameter set.

See

New-AzWebApp [[-ResourceGroupName] <String>] [-Name] <String> [[-Location] <String>]
 [[-AppServicePlan] <String>] [-ContainerImageName <String>] [-EnableContainerContinuousDeployment] [-AsJob]
 [-GitRepositoryPath <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
 [-Confirm] [<CommonParameters>]

New-AzWebApp [-ResourceGroupName] <String> [-Name] <String> [[-Location] <String>] [[-AppServicePlan] <String>]
 -ContainerImageName <String> -ContainerRegistryUrl <String> -ContainerRegistryUser <String>
 -ContainerRegistryPassword <SecureString> [-EnableContainerContinuousDeployment] [-AsJob]
 [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]

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]
 [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]

Which means AseResourceGroupName and AseName (in last parameter set) can't work with Tag together in New-AzWebApp. @Kotasudhakarreddy could you check is this behavior by design?

@Kotasudhakarreddy
Copy link
Contributor Author

@BethanyZhou - Yes, it is by design.
@Poolshark314 please raise a new bug to extend this feature for all the ParameterSetNames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants