Skip to content

Invoke-AzureRmResourceAction --> The HTTP method 'POST' is not supported on the resource #9709

@JulienFloris

Description

@JulienFloris

Description

We Are trying to Use az cmdlet: 'Invoke-AzResourceAction' Only it is giving the following error:

Invoke-AzResourceAction : MethodNotAllowed : The HTTP method 'POST' is not supported on the resource 'https://management.westeurope.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01'.

When I skip the API version param is give's an error that the API version is not supported, and if it would be using the latests that would propably be correct.

Invoke-WebRequest with the same URI those work.

Docs about this API:

Steps to reproduce

Login-AzAccount
Get-AzProviderOperation -OperationSearchString "Microsoft.Sql/locations/usages/read"
Invoke-AzResourceAction -ResourceType Microsoft.Sql/locations -ResourceName westeurope -Action usages -ApiVersion 2015-05-01 -Force

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.14393.3053
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.3053
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

PS C:\windows\system32> Get-Module  -ListAvailable

    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name
---------- -------    ----
Manifest   1.4.0.0    AuditPolicyDSC
Script     1.6.0      Az.Accounts
Script     1.0.0      Az.Advisor
Script     1.0.1      Az.Aks
Script     1.1.0      Az.AnalysisServices
Script     1.2.0      Az.ApiManagement
Script     1.0.0      Az.ApplicationInsights
Script     1.3.0      Az.Automation
Script     1.1.0      Az.Batch
Script     1.0.0      Az.Billing
Script     1.3.0      Az.Cdn
Script     1.1.1      Az.CognitiveServices
Script     2.4.0      Az.Compute
Script     1.0.1      Az.ContainerInstance
Script     1.0.1      Az.ContainerRegistry
Script     1.1.2      Az.DataFactory
Script     1.0.0      Az.DataLakeAnalytics
Script     1.2.1      Az.DataLakeStore
Script     1.0.0      Az.DeploymentManager
Script     1.0.0      Az.DevTestLabs
Script     1.1.1      Az.Dns
Script     1.2.1      Az.EventGrid
Script     1.2.0      Az.EventHub
Script     1.1.0      Az.FrontDoor
Script     2.0.0      Az.HDInsight
Script     1.2.0      Az.IotHub
Script     1.2.0      Az.KeyVault
Script     1.2.1      Az.LogicApp
Script     1.1.0      Az.MachineLearning
Script     1.0.0      Az.MarketplaceOrdering
Script     1.1.0      Az.Media
Script     1.2.1      Az.Monitor
Script     1.11.0     Az.Network
Script     1.1.0      Az.NotificationHubs
Script     1.3.1      Az.OperationalInsights
Script     1.1.2      Az.PolicyInsights
Script     1.1.0      Az.PowerBIEmbedded
Script     1.4.2      Az.RecoveryServices
Script     1.1.0      Az.RedisCache
Script     1.0.1      Az.Relay
Script     1.6.0      Az.Resources
Script     1.2.1      Az.ServiceBus
Script     1.1.1      Az.ServiceFabric
Script     1.0.2      Az.SignalR
Script     1.13.0     Az.Sql
Script     1.5.0      Az.Storage
Script     1.1.1      Az.StorageSync
Script     1.0.0      Az.StreamAnalytics
Script     1.0.1      Az.TrafficManager
Script     1.3.0      Az.Websites
Manifest   6.1.0.0    ComputerManagementDsc
Manifest   1.0.0.1    cSchannel
Script     1.0.1      Microsoft.PowerShell.Operation.V...
Script     1.4.3      PackageManagement
Binary     1.0.0.1    PackageManagement
Script     3.4.0      Pester
Script     2.2        PowerShellGet
Script     1.0.0.1    PowerShellGet
Script     1.2        PSReadline
Manifest   2.7.0.0    SecurityPolicyDsc
Script     8.4.0.0    xPSDesiredStateConfiguration
Manifest   2.7.0.0    xWindowsUpdate


    Directory: C:\windows\system32\WindowsPowerShell\v1.0\


ModuleType Version    Name
---------- -------    ----
Manifest   1.0.0.0    ActiveDirectory
Manifest   1.0.0.0    AppBackgroundTask
Manifest   2.0.0.0    AppLocker
Manifest   1.0.0.0    AppvClient
Manifest   2.0.0.0    Appx
Script     1.0.0.0    AssignedAccess
Manifest   1.0        BestPractices
Manifest   1.0.0.0    BitLocker
Manifest   2.0.0.0    BitsTransfer
Manifest   1.0.0.0    BranchCache
Manifest   1.0.0.0    CimCmdlets
Manifest   1.0        ConfigCI
Manifest   1.0        Defender
Binary     2.0.0.0    DFSR
Manifest   1.0.0.0    DirectAccessClientComponents
Script     3.0        Dism
Manifest   1.0.0.0    DnsClient
Manifest   2.0.0.0    DnsServer
Manifest   1.0.0.0    EventTracingManagement
Manifest   1.0.0.0    GroupPolicy
Manifest   2.0.0.0    International
Manifest   1.0.0.0    iSCSI
Manifest   2.0.0.0    IscsiTarget
Script     1.0.0.0    ISE
Manifest   1.0.0.0    Kds
Manifest   1.0.1.0    Microsoft.PowerShell.Archive
Manifest   3.0.0.0    Microsoft.PowerShell.Diagnostics
Manifest   3.0.0.0    Microsoft.PowerShell.Host
Manifest   1.0.0.0    Microsoft.PowerShell.LocalAccounts
Manifest   3.1.0.0    Microsoft.PowerShell.Management
Script     1.0        Microsoft.PowerShell.ODataUtils
Manifest   3.0.0.0    Microsoft.PowerShell.Security
Manifest   3.1.0.0    Microsoft.PowerShell.Utility
Manifest   3.0.0.0    Microsoft.WSMan.Management
Manifest   1.0        MMAgent
Manifest   1.0.0.0    MsDtc
Manifest   2.0.0.0    NetAdapter
Manifest   1.0.0.0    NetConnection
Manifest   1.0.0.0    NetEventPacketCapture
Manifest   2.0.0.0    NetLbfo
Manifest   1.0.0.0    NetNat
Manifest   2.0.0.0    NetQos
Manifest   2.0.0.0    NetSecurity
Manifest   1.0.0.0    NetSwitchTeam
Manifest   1.0.0.0    NetTCPIP
Manifest   1.0.0.0    NetworkConnectivityStatus
Manifest   1.0.0.0    NetworkSwitchManager
Manifest   1.0.0.0    NetworkTransition
Manifest   1.0        NFS
Manifest   1.0.0.0    Nps
Manifest   1.0.0.0    PcsvDevice
Manifest   1.0.0.0    PKI
Manifest   1.0.0.0    PlatformIdentifier
Manifest   1.0.0.0    PnpDevice
Manifest   1.1        PrintManagement
Manifest   1.1        PSDesiredStateConfiguration
Script     1.0.0.0    PSDiagnostics
Binary     1.1.0.0    PSScheduledJob
Manifest   2.0.0.0    PSWorkflow
Manifest   1.0.0.0    PSWorkflowUtility
Manifest   2.0.0.0    RemoteDesktop
Manifest   1.0.0.0    ScheduledTasks
Manifest   2.0.0.0    SecureBoot
Manifest   1.0.0.0    SecurityCmdlets
Script     1.0.0.0    ServerCore
Script     2.0.0.0    ServerManager
Cim        1.0.0.0    ServerManagerTasks
Manifest   2.0.0.0    SmbShare
Manifest   2.0.0.0    SmbWitness
Manifest   2.0.0.0    SoftwareInventoryLogging
Manifest   1.0.0.0    StartLayout
Manifest   2.0.0.0    Storage
Manifest   2.0.0.0    TLS
Manifest   1.0.0.0    TroubleshootingPack
Manifest   2.0.0.0    TrustedPlatformModule
Binary     2.1.639.0  UEV
Manifest   1.0.0.0    UserAccessLogging
Manifest   2.0.0.0    VpnClient
Manifest   1.0.0.0    Wdac
Manifest   2.0.0.0    Whea
Manifest   1.0.0.0    WindowsDeveloperLicense
Script     1.0        WindowsErrorReporting
Manifest   1.0.0.0    WindowsSearch
Manifest   1.0.0.0    WindowsUpdate


    Directory: C:\Program Files\Microsoft Monitoring Agent


ModuleType Version    Name
---------- -------    ----
Binary     1.0        HybridRegistration


    Directory: C:\Program Files\Microsoft Monitoring Agent


ModuleType Version    Name
---------- -------    ----
Binary     1.0        Orchestrator.AssetManagement.Cmd...


    Directory: C:\Program Files\Microsoft Monitoring Agent


ModuleType Version    Name
---------- -------    ----
Script     2.4        Microsoft.Assessments.AADApplica...
Binary     1.0.0.0    Microsoft.MonitoringAgent.PowerS...
Binary     8.0.1.294  Microsoft.PowerShell.Oms.Assessm...

Debug output

PS C:\windows\system32> Invoke-AzResourceAction -ResourceType Microsoft.Sql/locations -ResourceName westeurope -Action usages -ApiVersion 2015-05-01 -Force
DEBUG: 2:56:39 PM - InvokAzureResourceActionCmdlet begin processing with ParameterSet 'BySubscriptionLevel'.
DEBUG: 2:56:39 PM - using account id '[email protected]'...
DEBUG: [Common.Authentication]: Authenticating using Account: '[email protected]', environment: 'AzureCloud', tenant: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx', Endpoint: 'https://login.microsoftonline.com/', ClientId: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows
ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using context with Authority 'https://login.microsoftonline.com/xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx/', CorrelationId: '00000000-0000-0000-0000-000000000000', ValidateAuthority: 'True'
DEBUG: [Common.Authentication]: Acquiring token using AdalConfiguration with Domain: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx', AdEndpoint: 'https://login.microsoftonline.com/', ClientId: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx', ClientRedirectUri: urn:ietf:wg:oauth:2.0:oob
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.3982105Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.3982105Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: ADAL PCL.Desktop with assembly version '3.19.2.6005', file version '3.19.50302.0130' and informational version '2a8bec6c4c76d0c1ef819b55bdc3cda2d2605056' is running...
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.3992104Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: === Token Acquisition started:
 CacheType: null
 Authentication Target: User
 , Authority Host: login.microsoftonline.com
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.3992104Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: === Token Acquisition started:
 Authority: https://login.microsoftonline.com/xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx/
 Resource: https://management.core.windows.net/
 ClientId: xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
 CacheType: null
 Authentication Target: User

DEBUG: [ADAL]: Verbose: 2019-07-23T12:56:39.5482107Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Verbose: 2019-07-23T12:56:39.5482107Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5502101Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 1 items to token cache.
DEBUG: [ADAL]: Verbose: 2019-07-23T12:56:39.5602091Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Verbose: 2019-07-23T12:56:39.5602091Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5672245Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5672245Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5692093Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: 41.5548965116667 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5692093Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: 41.5548965116667 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5692093Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5692093Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5712092Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 7/23/2019 1:38:12 PM +00:00
DEBUG: [ADAL]: Information: 2019-07-23T12:56:39.5712092Z: 166a0622-9270-4205-8300-e2448235ddb6 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 7/23/2019 1:38:12 PM +00:00Access Token Hash: Zcxa3QkqrxW8mL6XMg/ryeJPJNzymeq6zHoiGWYkI9w=
  User id: xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx
DEBUG: [Common.Authentication]: Renewing Token with Type: 'Bearer', Expiry: '07/23/2019 13:38:12 +00:00', MultipleResource? 'True', Tenant: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx', UserId: '[email protected]'
DEBUG: [Common.Authentication]: User info for token DisplayId: '[email protected]', Name: xxxxxxxx xxxxxxxx, IdProvider: 'https://sts.windows.net/xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx/', Uid: 'xxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx'
DEBUG: [Common.Authentication]: Checking token expiration, token expires '07/23/2019 13:38:12 +00:00' Comparing to '07/23/2019 12:56:39 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:41:33.2627898'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
POST

Absolute Uri:
https://management.azure.com/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01

Headers:
User-Agent                    : PSVersion/v5.1.14393.3053,AzurePowershell/v1.0.0
ParameterSetName              : BySubscriptionLevel
CommandName                   : Invoke-AzResourceAction

Body:


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

Status Code:
MethodNotAllowed

Headers:
Pragma                        : no-cache
x-ms-request-id               : 252abeaf-e312-442a-baf6-8e57949b7082
x-ms-ratelimit-remaining-subscription-writes: 1199
x-ms-correlation-request-id   : 67a88f2d-2f4f-4116-9c25-3afcb80d0cbe
x-ms-routing-request-id       : NORTHEUROPE:20190723T125639Z:67a88f2d-2f4f-4116-9c25-3afcb80d0cbe
Strict-Transport-Security     : max-age=31536000; includeSubDomains
X-Content-Type-Options        : nosniff
Cache-Control                 : no-cache
Date                          : Tue, 23 Jul 2019 12:56:39 GMT
Server                        : Microsoft-HTTPAPI/2.0

Body:
{
  "error": {
    "code": "MethodNotAllowed",
    "message": "The HTTP method 'POST' is not supported on the resource 'https://management.westeurope.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01'."
  }
}

Invoke-AzResourceAction : MethodNotAllowed : The HTTP method 'POST' is not supported on the resource 'https://management.westeurope.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01'.
At line:1 char:1
+ Invoke-AzResourceAction -ResourceType Microsoft.Sql/locations -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Invoke-AzResourceAction], ErrorResponseMessageException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.InvokAzureResourceActionCmdlet

DEBUG: AzureQoSEvent: CommandName - Invoke-AzResourceAction; IsSuccess - False; Duration - 00:00:00.7726954; Exception - Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses.ErrorResponseMessageException: MethodNotAllowed : The HTTP method 'POST' is not supported on the resource
'https://management.westeurope.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01'.
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleException(ExceptionDispatchInfo capturedException)
   at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet()
   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 2:56:40 PM - InvokAzureResourceActionCmdlet end processing.
DEBUG: 2:56:40 PM - InvokAzureResourceActionCmdlet end processing.

Error output

PS C:\windows\system32> Resolve-AzError
DEBUG: 2:57:10 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 2:57:10 PM - using account id '[email protected]'...


   HistoryId: 3


Message        : MethodNotAllowed : The HTTP method 'POST' is not supported on the resource 'https://management.westeurope.control.database.windows.net/modules/AzureResourceManager/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/providers/Microsoft.Sql/locations/westeurope/usages?api-version=2015-05-01'.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.HandleException(ExceptionDispatchInfo capturedException)
                    at Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.ResourceManagerCmdletBase.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses.ErrorResponseMessageException
InvocationInfo : {Invoke-AzResourceAction}
Line           : Invoke-AzResourceAction -ResourceType Microsoft.Sql/locations -ResourceName westeurope -Action usages -ApiVersion 2015-05-01 -Force
Position       : At line:1 char:1
                 + Invoke-AzResourceAction -ResourceType Microsoft.Sql/locations -Resour ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 3

DEBUG: AzureQoSEvent: CommandName - Resolve-AzError; IsSuccess - True; Duration - 00:00:00.0801957; Exception - ;
DEBUG: Finish sending metric.
DEBUG: 2:57:11 PM - ResolveError end processing.
DEBUG: 2:57:11 PM - ResolveError end processing.

Metadata

Metadata

Labels

ARMARM - CoreARM - Core TriagedService AttentionThis issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions