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

Confusing Error Message for Backup-AzApiManagement Command #26536

Open
rui-hi opened this issue Oct 30, 2024 · 3 comments
Open

Confusing Error Message for Backup-AzApiManagement Command #26536

rui-hi opened this issue Oct 30, 2024 · 3 comments
Labels
API Management bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Service Attention This issue is responsible by Azure service team.

Comments

@rui-hi
Copy link

rui-hi commented Oct 30, 2024

Description

When using the Backup-AzApiManagement command with only backup operation permissions, the command returns the error message 'Long running operation failed with status 'Forbidden'.

However, the backup operation actually succeeds. It appears this error occurs due to insufficient permissions to access the URL in the location header returned by the backup operation's REST call, specifically the permissions to get the operation results.

This error message is very misleading and makes it difficult to understand what permissions are actually required to execute the command successfully. Could you please update the error message to provide clearer guidance on the necessary permissions? thanks in advance!

Issue script & Debug output

PS /home/> Backup-AzApiManagement -ResourceGroupName $rg -Name $intApimName -StorageContext $storageContext -TargetContainerName $container -TargetBlobName $blob
DEBUG: 1+ >>>> Backup-AzApiManagement -ResourceGroupName $rg -Name $intApimName -StorageContext $storageContext -TargetContainerName $container -TargetBlobName $blob
DEBUG: 17+ function Get-ConciseViewPositionMessage >>>> {

DEBUG: 29+ >>>> $posmsg = ''

DEBUG: 30+ >>>> $headerWhitespace = ''

DEBUG: 31+ >>>> $offsetWhitespace = ''

DEBUG: 32+ >>>> $message = ''

DEBUG: 33+ >>>> $prefix = ''

DEBUG: 39+ if ( >>>> (($err.CategoryInfo.Category -eq 'ParserError' -and $err.Exception -is 'System.Management.Automation.ParentContainsErrorRecordException') -or $myinv.ScriptName -or $myinv.ScriptLineNumber -gt 1) -and $myinv.ScriptName -notmatch '.psm1$') {

DEBUG: 113+ if ( >>>> ! $err.ErrorDetails -or ! $err.ErrorDetails.Message) {

DEBUG: 114+ if ( >>>> $err.CategoryInfo.Category -eq 'ParserError' -and $err.Exception.Message.Contains("~$newline")) {

DEBUG: 118+ elseif ( >>>> $err.Exception) {

DEBUG: 119+ >>>> $message += $err.Exception.Message

DEBUG: 133+ if ( >>>> $myinv -and $myinv.ScriptName -or $err.CategoryInfo.Category -eq 'ParserError') {

DEBUG: 173+ >>>> $posmsg += "${errorColor}" + $message

DEBUG: 175+ >>>> $reason = 'Error'

DEBUG: 176+ if ( >>>> $err.Exception -and $err.Exception.WasThrownFromThrowStatement) {

DEBUG: 180+ elseif ( >>>> $myinv.MyCommand -and $myinv.MyCommand.Name -and (Get-Command -Name $myinv.MyCommand -ErrorAction Ignore))

DEBUG: 182+ >>>> $reason = $myinv.MyCommand

DEBUG: 201+ >>>> $errorMsg = 'Error'

DEBUG: 203+ >>>> "${errorColor}${reason}: ${posmsg}${resetcolor}"

DEBUG: 204+ >>>> }

DEBUG: 1+ & >>>> { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { >>>> Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { Set-StrictMode -Version 1; >>>> $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails >>>> }
DEBUG: 1+ & >>>> { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { >>>> Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { Set-StrictMode -Version 1; >>>> $this.Exception.InnerException.PSMessageDetails }
DEBUG: 1+ & { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails >>>> }
Backup-AzApiManagement: Long running operation failed with status 'Forbidden'.

Environment data

NA

Module versions

PS /home/> Get-Module -Name Az.ApiManagement -ListAvailable

Directory: /usr/local/share/powershell/Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 4.0.4 Az.ApiManagement Core,Desk {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion…}

Error output

No response

@rui-hi rui-hi added bug This issue requires a change to an existing behavior in the product in order to be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 30, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported needs-triage This is a new issue that needs to be triaged to the appropriate team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 30, 2024
@isra-fel isra-fel added API Management Service Attention This issue is responsible by Azure service team. and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Oct 31, 2024
Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @solankisamir, @mikebudzynski, @KedarJoshi, @yingru97.

@isra-fel
Copy link
Member

The permission of querying operation results should not be more strict than initiating the first api IMO. I'll loop in API management team for more insights.

Copy link
Contributor

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @solankisamir, @mikebudzynski, @KedarJoshi, @yingru97.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Management bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

2 participants