Azure / Azure/azure-powershell

New-AzApiManagementApiRevision Failing with API Id on PUT request

Open
#24,144 7 comments 1 reaction 0 assignees View on GitHub
act-observability-squad API Management bug customer-reported Service Attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
3d 14h
Merged PRs (30d)
54

Description

### Description

New-AzApiManagementApiRevision is failing when being called.

The output is displaying " Property id '/apis/$apiId;rev=13' at path 'properties.sourceApiId' is invalid

The command appears to get the API first, then on the PUT call to change fails to get the API
The error also states that "Expect fully qualified resource Id" however when passing a full resource ID the web request fails the get request and appends the full resource ID onto the resource ID without the API id"

The last successful deploy was on January 4th. the next attempted deploy was February 4th and failed.

[Learn.microsoft.](https://learn.microsoft.com/en-us/powershell/module/az.apimanagement/new-azapimanagementapirevision?view=azps-11.2.0) states the ID should just be the name, while the command itself states the API id should be the full resource ID.

It appears the get request is handled via just the API ID while the put request is handled differently.

### Issue script & Debug output

```PowerShell
$tenant = ""
$resourceGroup = ""
$apimInstance = ""
$apiId = ""
$apiName = ""
$ctx = New-AzApiManagementContext -ResourceId "/subscriptions/$Tenant/resourceGroups/$resourceGroup/providers/Microsoft.ApiManagement/service/$apimInstance/apis/$apiId"
$currentApiManagementApi = Get-AzApiManagementApi -Context $ctx | Where-Object name -EQ "$APIName"
$currentRevision = $currentApiManagementApi | Where-Object { $_.IsCurrent } | Sort-Object -Descending ApiRevision | Select-Object -First 1
$apiCtx = New-AzApiManagementContext -ResourceId $currentRevision.Id
$sanitizedVersion = 1
$apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $currentRevision.ApiId -ApiRevision $sanitizedVersion -SourceApiRevision $currentRevision.ApiRevision

######
# DEBUG OUTPUT
######

DEBUG: 4:17:21 PM - NewAzureApiManagementApiRevision begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 4:17:21 PM - using account id 'my.email@address.com'...
DEBUG: 4:17:21 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: [Common.Authentication]: Authenticating using Account: 'my.email@address.com', environment: 'AzureCloud', tenant: '$tenant'
DEBUG: 4:17:21 PM - [ConfigManager] Got nothing from [EnableLoginByWam], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 4:17:21 PM - [SilentAuthenticator] Calling SharedTokenCacheCredential.GetTokenAsync - TenantId:'$tenant', Scopes:'https://management.core.windows.net//.default', AuthorityHost:'https://login.microsoftonline.com/', UserId:'my.email@address.com'
DEBUG: SharedTokenCacheCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - a8384420-8696-4e4b-b5b6-3bfc463ed9c9] IsLegacyAdalCacheEnabled: yes
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z] Found 2 cache accounts and 0 broker accounts
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z] Returning 2 accounts
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] MSAL MSAL.CoreCLR with assembly version '4.56.0.0'. CorrelationId(d712623f-4c33-4f3e-baea-866d94735e2f)
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] === AcquireTokenSilent Parameters ===
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] LoginHint provided: False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] Account provided: True
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] ForceRefresh: False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenSilent
IsConfidentialClient - False
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - d712623f-4c33-4f3e-baea-866d94735e2f
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] === Token Acquisition (SilentRequest) started:
Scopes: https://management.core.windows.net//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] Access token is not expired. Returning the found cache entry. [Current time (02/08/2024 23:17:21) - Expiration Time (02/08/2024 23:28:06 +00:00) - Extended Expiration Time (02/08/2024 23:28:06 +00:00)]
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] Returning access token found in cache. RefreshOn exists ? False
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] [Region discovery] Not using a regional authority.
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.56.0.0 MSAL.CoreCLR .NET 8.0.1 Microsoft Windows 10.0.19042 [2024-02-08 23:17:21Z - d712623f-4c33-4f3e-baea-866d94735e2f] AT expiration time: 2/8/2024 11:28:06 PM +00:00, scopes: https://management.core.windows.net//user_impersonation https://management.core.windows.net//.default. source: Cache
DEBUG: SharedTokenCacheCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2024-02-08T23:28:06.0000000+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '$tenant', UserId: 'my-email@address.com'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com/subscriptions/$tenant/resourceGroups/$resourceGroup/providers/Microsoft.ApiManagement/service/$apimResource/apis/$apiId?api-version=2021-08-01

Headers:
Accept-Language : en-US
x-ms-client-request-id : cc411e8e-9d30-4e96-ae04-ea3f0bc1cbb7

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Cache-Control : no-cache
Pragma : no-cache
ETag : "AAAAAAAMtsc="
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
x-ms-request-id : a47fba47-116e-4c8a-9181-4782e1ad1bb5
x-ms-ratelimit-remaining-subscription-reads: 11997
x-ms-correlation-request-id : a47fba47-116e-4c8a-9181-4782e1ad1bb5
x-ms-routing-request-id : WESTCENTRALUS:20240208T231722Z:a47fba47-116e-4c8a-9181-4782e1ad1bb5
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: A00BBA7397764B27879B5EB32469F6B4 Ref B: CYS013050702031 Ref C: 2024-02-08T23:17:21Z
Date : Thu, 08 Feb 2024 23:17:21 GMT

Body:
{
"id": "/subscriptions/$tenant/resourceGroups/$resourceGroup/providers/Microsoft.ApiManagement/service/$apimResource/apis/$apiId",
"type": "Microsoft.ApiManagement/service/apis",
"name": "$apiId",
"properties": {
"displayName": "LD.Treasury.Funding.Host.Web",
"apiRevision": "13",
"description": "",
"subscriptionRequired": true,
"serviceUrl": null,
"backendId": null,
"path": "treasurywlms-funding",
"protocols": [
"https"
],
"authenticationSettings": {
"oAuth2": null,
"openid": null
},
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"isCurrent": true
}
}

DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
PUT

Absolute Uri:
https://management.azure.com/subscriptions/$tenant/resourceGroups/$resourceGroup/providers/Microsoft.ApiManagement/service/$apimResource/apis/$apiId%3Brev%3D1?api-version=2021-08-01

Headers:
Accept-Language : en-US
x-ms-client-request-id : cc411e8e-9d30-4e96-ae04-ea3f0bc1cbb7

Body:
{
"properties": {
"sourceApiId": "/apis/$apiId;rev=13",
"path": "treasurywlms-funding"
}
}

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
BadRequest

Headers:
Cache-Control : no-cache
Pragma : no-cache
x-ms-failure-cause : gateway
x-ms-request-id : 0e3224b2-e4b7-4959-8194-9553ce4f23df
x-ms-correlation-request-id : 0e3224b2-e4b7-4959-8194-9553ce4f23df
x-ms-routing-request-id : WESTCENTRALUS:20240208T231722Z:0e3224b2-e4b7-4959-8194-9553ce4f23df
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
X-Cache : CONFIG_NOCACHE
X-MSEdge-Ref : Ref A: 062D449D065B4DDC963948FFBA851787 Ref B: CYS013050702031 Ref C: 2024-02-08T23:17:22Z
Date : Thu, 08 Feb 2024 23:17:21 GMT

Body:
{
"error": {
"code": "LinkedInvalidPropertyId",
"message": "Property id '/apis/$apiId;rev=13' at path 'properties.sourceApiId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'."
}
}

DEBUG: 4:17:22 PM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 4:17:22 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
New-AzApiManagementApiRevision:
Error Code: LinkedInvalidPropertyId
Error Message: Property id '/apis/$apiId;rev=13' at path 'properties.sourceApiId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Request Id: 0e3224b2-e4b7-4959-8194-9553ce4f23df
DEBUG: 4:17:22 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 4:17:22 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 4:17:22 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.ApiManagement:4.0.2; CommandName: New-AzApiManagementApiRevision; PSVersion: 7.4.1; IsSuccess: False; Duration: 00:00:00.9936856; Exception:
Error Code: LinkedInvalidPropertyId
Error Message: Property id '/apis/$apiId;rev=13' at path 'properties.sourceApiId' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Request Id: 0e3224b2-e4b7-4959-8194-9553ce4f23df
;
DEBUG: 4:17:22 PM - NewAzureApiManagementApiRevision end processing.
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

### Module versions

```PowerShell
PS C:\Users\marcfoster> Get-Module Az*

ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.15.1 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzConte…
Script 4.0.2 Az.ApiManagement {Add-AzApiManagementApiToGateway, Add-AzApiManage…
```

### Error output

```PowerShell
DEBUG: 4:29:08 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 4:29:08 PM - using account id 'my.email@address.com'...
DEBUG: 4:29:08 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId: 25

Message :
Error Code: LinkedInvalidPropertyId
Error Message: Property id '/apis/$apiId;rev=13' at path
'properties.sourceApiId' is invalid. Expect fully qualified resource Id that start with
'/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Request Id: 0e3224b2-e4b7-4959-8194-9553ce4f23df

StackTrace :
Exception : System.Exception
InvocationInfo : {New-AzApiManagementApiRevision}
Line : $apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $currentRevision.ApiId
-ApiRevision $sanitizedVersion -SourceApiRevision $currentRevision.ApiRevision
Position : At line:1 char:16
+ … iRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $c …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 25

HistoryId: 22

Message :
Error Code: LinkedInvalidPropertyId
Error Message: Property id '/apis/$apiId;rev=13' at path
'properties.sourceApiId' is invalid. Expect fully qualified resource Id that start with
'/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
Request Id: e791383b-71b5-48b3-9506-5bd234292868

StackTrace :
Exception : System.Exception
InvocationInfo : {New-AzApiManagementApiRevision}
Line : $apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $currentRevision.ApiId
-ApiRevision $sanitizedVersion -SourceApiRevision $currentRevision.ApiRevision
Position : At line:1 char:16
+ … iRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $c …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 22

HistoryId: 11

Message : Cannot validate argument on parameter 'Context'. The argument is null or empty. Provide an argument
that is not null or empty, and then try the command again.
StackTrace : at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
at
System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal
argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter,
ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32
parameterSets, Collection`1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
on(Collection`1 arguments)
at
System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
Exception : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {New-AzApiManagementApiRevision}
Line : $apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $currentRevision.ApiId
-ApiRevision $sanitizedVersion -SourceApiRevision $currentRevision.ApiRevision
Position : At line:1 char:56
+ … apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId …
+ ~~~~~~~
HistoryId : 11

Message : The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
StackTrace : at System.Management.Automation.ValidateNotNullOrAttributeBase.Validate(Object arguments,
EngineIntrinsics engineIntrinsics)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
Exception : System.Management.Automation.ValidationMetadataException
InvocationInfo : {New-AzApiManagementApiRevision}
Line : $apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId $currentRevision.ApiId
-ApiRevision $sanitizedVersion -SourceApiRevision $currentRevision.ApiRevision
Position : At line:1 char:56
+ … apiRevision = New-AzApiManagementApiRevision -Context $apiCtx -ApiId …
+ ~~~~~~~
HistoryId : 11

HistoryId: 9

Message : Cannot bind argument to parameter 'ResourceId' because it is null.
StackTrace : at
System.Management.Automation.ParameterBinderBase.ValidateNullOrEmptyArgument(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, Type argumentType, Object parameterValue,
Boolean recurseIntoCollections)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
at
System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal
argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter,
ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32
parameterSets, Collection`1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
on(Collection`1 arguments)
at
System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
Exception : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {New-AzApiManagementContext}
Line : $apiCtx = New-AzApiManagementContext -ResourceId $currentRevision.Id
Position : At line:1 char:50
+ $apiCtx = New-AzApiManagementContext -ResourceId $currentRevision.Id
+ ~~~~~~~~~~~~~~~~~~~
HistoryId : 9

HistoryId: 7

Message : Cannot validate argument on parameter 'Context'. The argument is null or empty. Provide an argument
that is not null or empty, and then try the command again.
StackTrace : at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
at
System.Management.Automation.CmdletParameterBinderController.BindParameter(CommandParameterInternal
argument, MergedCompiledCommandParameter parameter, ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter,
ParameterBindingFlags flags)
at System.Management.Automation.CmdletParameterBinderController.BindNamedParameter(UInt32
parameterSets, CommandParameterInternal argument, MergedCompiledCommandParameter parameter)
at System.Management.Automation.ParameterBinderController.BindNamedParameters(UInt32
parameterSets, Collection`1 arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidati
on(Collection`1 arguments)
at
System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1
arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary
psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object
input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
Exception : System.Management.Automation.ParameterBindingValidationException
InvocationInfo : {Get-AzApiManagementApi}
Line : $currentApiManagementApi = Get-AzApiManagementApi -Context $apiCtx | Where-Object name -EQ "$APIName"
Position : At line:1 char:60
+ … entApiManagementApi = Get-AzApiManagementApi -Context $apiCtx | Wher …
+ ~~~~~~~
HistoryId : 7

Message : The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
StackTrace : at System.Management.Automation.ValidateNotNullOrAttributeBase.Validate(Object arguments,
EngineIntrinsics engineIntrinsics)
at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal
parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
Exception : System.Management.Automation.ValidationMetadataException
InvocationInfo : {Get-AzApiManagementApi}
Line : $currentApiManagementApi = Get-AzApiManagementApi -Context $apiCtx | Where-Object name -EQ "$APIName"
Position : At line:1 char:60
+ … entApiManagementApi = Get-AzApiManagementApi -Context $apiCtx | Wher …
+ ~~~~~~~
HistoryId : 7

DEBUG: 4:29:08 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 4:29:08 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.15.1; CommandName: Resolve-AzError; PSVersion: 7.4.1; IsSuccess: True; Duration: 00:00:00.0258108
DEBUG: 4:29:08 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 4:29:08 PM - ResolveError end processing.
```

Contributor guide

Open the contributing guide

Research direction

Start with the New-AzApiManagementApiRevision cmdlet and reproduce the provided PowerShell script, comparing the successful GET with the failing PUT in the debug output. Trace how ApiId and sourceApiId are built; done means a revision request accepts the expected resource ID format and the PUT succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, powershell
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.