Azure / Azure/azure-powershell
New-AzApiManagementProduct -ApprovalRequired is defaulted to False even when the input is $True
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 51
Description
### Description
Trying to create a APIM product with approval required set to True but the command is setting it to False always.
Sample Script
$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementProduct -Context $ApiMgmtContext -ProductId "9876543210" -Title "Unlimite1234656d" -Description "Subscribers have completely unlimited access to the API. Administrator approval is required." -LegalTerms "Free for all" -ApprovalRequired $True -State "Published"
Output:
ProductId : 9876543210
Title : Unlimite1234656d
Description : Subscribers have completely unlimited access to the API. Administrator approval is required.
LegalTerms : Free for all
SubscriptionRequired : True
ApprovalRequired : False
### Issue script & Debug output
```PowerShell
Sample Script
$apimContext = New-AzApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"
New-AzApiManagementProduct -Context $ApiMgmtContext -ProductId "9876543210" -Title "Unlimite1234656d" -Description "Subscribers have completely unlimited access to the API. Administrator approval is required." -LegalTerms "Free for all" -ApprovalRequired $True -State "Published"
Output:
ProductId : 9876543210
Title : Unlimite1234656d
Description : Subscribers have completely unlimited access to the API. Administrator approval is required.
LegalTerms : Free for all
SubscriptionRequired : True
ApprovalRequired : False
```
### Environment data
```PowerShell
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS CBL-Mariner/Linux
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```
### Module versions
```PowerShell
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.17.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Script 4.0.2 Az.ApiManagement {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGrou…
Script 7.2.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk…}
Script 7.4.1 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add…
Script 6.16.1 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment…}
Script 6.1.3 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccoun…
Script 1.1.3 Az.Tools.Predictor {Disable-AzPredictor, Enable-AzPredictor, Open-AzPredictorSurvey, Send-AzPredictorRating}
Script 0.0.0.10 AzureAD.Standard.Preview {Add-AzureADApplicationOwner, Add-AzureADDeviceRegisteredOwner, Add-AzureADDeviceRegisteredUser, Ad…
Script 0.9.3 AzurePSDrive
```
### Error output
_No response_
Contributor guide
Research direction
Start at the New-AzApiManagementProduct implementation and reproduce the provided PowerShell script with -ApprovalRequired $True. Trace how that parameter is passed when creating the APIM product, then verify that the command output reports ApprovalRequired as True and add or update coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell
- Domain
- api, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100