'Getting Error 'Forbidden' on certain cmdlets
Description
Hi, I'm experiencing intermittent issues on certain cmdlets, namely : Get-AzConsumptionPriceSheet Get-AzConsumptionUsageDetail Get-AzReservationOrder
I'm running these when authenticated via a Sevice Principal and started having issues a couple of days ago when previously everything was fine. These work without issue when I'm authenticated via my Azure AD creds.
The Service Principal has 'Owner' permissions on the subscription in question (same as my Azure AD creds). As a test I tried to access the API directly with the Service Principal ("https://management.azure.com/providers/Microsoft.Capacity/reservationOrders?api-version=2019-04-01") and it worked ok.
Steps to reproduce
Get-AZReservationOrder
Environment data
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17763.1007
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.1007
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 (x86)\NetApp\Data ONTAP PowerShell Toolkit
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 3.1.0 DataONTAP {Add-NaAggr, Confirm-NaAggrSpareLow, Get-NaAggrMediaScrub, Get-NaAggrFilerInfo...}
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.7.2 Az.Accounts {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAutosave...}
Script 1.1.1 Az.Advisor {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Disable-AzAdvisorRecommendation, Get-AzAdvisorConfiguration...}
Script 1.0.3 Az.Aks {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}
Script 1.1.2 Az.AnalysisServices {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer, Remove-AzAnalysisServicesServer...}
Script 1.3.4 Az.ApiManagement {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, Add-AzApiManagementUserToGroup...}
Script 1.0.3 Az.ApplicationInsights {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplicationInsightsPricingPlan...}
Script 1.3.6 Az.Automation {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutputRecord, Import-AzAutomationDscNodeConfiguration...}
Script 2.0.2 Az.Batch {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount...}
Script 1.0.2 Az.Billing {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget...}
Script 1.4.2 Az.Cdn {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}
Script 1.2.3 Az.CognitiveServices {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccountSku, Get-AzCognitiveServicesAccountType...}
Script 3.5.0 Az.Compute {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet...}
Script 1.0.3 Az.ContainerInstance {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}
Script 1.1.1 Az.ContainerRegistry {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainerRegistry...}
Script 1.1.0 Az.DataBoxEdge {Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeDevice, Invoke-AzDataBoxEdgeDevice, New-AzDataBoxEdgeDevice...}
Script 1.6.1 Az.DataFactory {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}
Script 1.0.2 Az.DataLakeAnalytics {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAnalyticsCatalogCredential, Set-AzDataLakeAnalyticsCatalogCredential...}
Script 1.2.6 Az.DataLakeStore {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreFirewallRule, Set-AzDataLakeStoreTrustedIdProvider...}
Script 1.1.0 Az.DeploymentManager {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerArtifactSource, Set-AzDeploymentManagerArtifactSource, Remove-AzDeploymentManagerArtifactSource...}
Script 1.0.2 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}
Script 1.1.2 Az.Dns {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}
Script 1.2.3 Az.EventGrid {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}
Script 1.4.3 Az.EventHub {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubNamespace...}
Script 1.4.0 Az.FrontDoor {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFrontDoor...}
Script 3.0.3 Az.HDInsight {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStreamingMapReduceJobDefinition...}
Script 1.0.1 Az.HealthcareApis {New-AzHealthcareApisService, Remove-AzHealthcareApisService, Set-AzHealthcareApisService, Get-AzHealthcareApisService}
Script 2.1.0 Az.IotHub {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJob...}
Script 1.5.1 Az.KeyVault {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Get-AzKeyVaultCertificateOperation...}
Script 1.3.2 Az.LogicApp {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBatchConfiguration, Get-AzIntegrationAccountCallbackUrl...}
Script 1.1.3 Az.MachineLearning {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistory, Remove-AzMlCommitmentPlan...}
Script 1.0.2 Az.ManagedServices {Get-AzManagedServicesAssignment, New-AzManagedServicesAssignment, Remove-AzManagedServicesAssignment, Get-AzManagedServicesDefinition...}
Script 1.0.2 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}
Script 1.1.1 Az.Media {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMediaServiceKey, Get-AzMediaServiceNameAvailability...}
Script 1.6.0 Az.Monitor {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}
Script 2.3.1 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertificate, New-AzApplicationGatewayAuthenticationCertificate, Remove-AzApplicationGatewayAuthenticationCertificate...}
Script 1.1.1 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotificationHubPNSCredential...}
Script 1.3.4 Az.OperationalInsights {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSource, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsightsIISLogCollection...}
Script 1.2.0 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}
Script 1.1.1 Az.PowerBIEmbedded {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAccessKey, Get-AzPowerBIWorkspace...}
Script 1.0.2 Az.PrivateDns {Get-AzPrivateDnsZone, Remove-AzPrivateDnsZone, Set-AzPrivateDnsZone, New-AzPrivateDnsZone...}
Script 2.7.0 Az.RecoveryServices {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSettingsFile, New-AzRecoveryServicesVault...}
Script 1.2.1 Az.RedisCache {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, New-AzRedisCachePatchSchedule...}
Script 1.0.3 Az.Relay {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}
Script 0.8.2 Az.Reservations {Get-AzReservationOrder, Get-AzReservation, Get-AzReservationHistory, Update-AzReservation...}
Script 1.11.0 Az.Resources {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}
Script 1.4.1 Az.ServiceBus {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServiceBusNamespace...}
Script 2.0.1 Az.ServiceFabric {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricClusterCertificate, Add-AzServiceFabricNode, Add-AzServiceFabricNodeType...}
Script 1.1.1 Az.SignalR {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}
Script 2.3.0 Az.Sql {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, Set-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseUpgradeHint...}
Script 1.1.0 Az.SqlVirtualMachine {New-AzSqlVM, Get-AzSqlVM, Update-AzSqlVM, Remove-AzSqlVM...}
Script 1.12.0 Az.Storage {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey...}
Script 1.2.3 Az.StorageSync {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSyncService, Get-AzStorageSyncService, Remove-AzStorageSyncService...}
Script 1.0.1 Az.StreamAnalytics {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnalyticsFunction, Remove-AzStreamAnalyticsFunction...}
Script 1.0.3 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Remove-AzTrafficManagerCustomHeaderFromProfile...}
Script 1.6.0 Az.Websites {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}
Binary 2.0.0.0 HPEiLOCmdlets {Add-HPEiLODirectoryGroup, Add-HPEiLOFederationGroup, Add-HPEiLOInstallationQueueWaitTask, Add-HPEiLOInstallSet...}
Script 3.0.0 HPENimblePowerShellToolkit {Move-NSGroup, Get-NSNetworkConfig, Get-NSDisk, Get-NSActiveDirectoryMembership...}
Script 1.1.0.0 IISAdministration {Get-IISAppPool, Start-IISCommitDelay, Stop-IISCommitDelay, Get-IISSite...}
Script 6.2.3 ImportExcel {Add-ConditionalFormatting, Add-ExcelChart, Add-ExcelDataValidationRule, Add-ExcelName...}
Script 5.4.4 ImportExcel {Import-USPS, ConvertFrom-ExcelData, Test-String, Export-MultipleExcelSheets...}
Script 1.0.1 Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Manifest 1.1.183.57 MSOnline {Get-MsolDevice, Remove-MsolDevice, Enable-MsolDevice, Disable-MsolDevice...}
Script 1.4.6 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script 1.4.3 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}
Script 3.4.0 Pester {Describe, Context, It, Should...}
Script 1.4.3 Posh-ePoAPI
Script 2.2.3 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script 2.2 PowerShellGet {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability...}
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
Script 2.0.0 PSReadline {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSReadLineOption...}
Binary 2.5.0.214 SwisPowerShell {Connect-Swis, Get-SwisData, Get-SwisObject, Invoke-SwisVerb...}
Binary 2.3.0.108 SwisPowerShell {Connect-Swis, Get-SwisObject, Get-SwisData, Invoke-SwisVerb...}
Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0.1.0 ActiveDirectory {Add-ADCentralAccessPolicyMember, Add-ADComputerServiceAccount, Add-ADDomainControllerPasswordReplicationPolicy, Add-ADFineGrainedPasswordPolicySubject...}
Manifest 1.0.0.0 AppBackgroundTask {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Set-AppBackgroundTaskResourcePolicy, Unregister-AppBackgroundTask...}
Manifest 2.0.0.0 AppLocker {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy, Set-AppLockerPolicy...}
Manifest 1.0.0.0 AppvClient {Add-AppvClientConnectionGroup, Add-AppvClientPackage, Add-AppvPublishingServer, Disable-Appv...}
Manifest 2.0.1.0 Appx {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage...}
Script 1.0.0.0 AssignedAccess {Clear-AssignedAccess, Get-AssignedAccess, Set-AssignedAccess}
Manifest 1.0 BestPractices {Get-BpaModel, Get-BpaResult, Invoke-BpaModel, Set-BpaResult}
Manifest 1.0.0.0 BitLocker {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtector...}
Manifest 2.0.0.0 BitsTransfer {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer...}
Manifest 1.0.0.0 BranchCache {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading...}
Manifest 1.0.0.0 CimCmdlets {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession...}
Manifest 1.0 ConfigCI {Get-SystemDriver, New-CIPolicyRule, New-CIPolicy, Get-CIPolicy...}
Manifest 3.1.0 DataONTAP {Add-NaAggr, Confirm-NaAggrSpareLow, Get-NaAggrMediaScrub, Get-NaAggrFilerInfo...}
Manifest 1.0 Defender {Get-MpPreference, Set-MpPreference, Add-MpPreference, Remove-MpPreference...}
Manifest 1.0.1.0 DeliveryOptimization {Get-DeliveryOptimizationStatus, Get-DeliveryOptimizationPerfSnap, Get-DeliveryOptimizationLog, Get-DOConfig...}
Manifest 1.0 DFSN {Get-DfsnRoot, Remove-DfsnRoot, Set-DfsnRoot, New-DfsnRoot...}
Binary 2.0.0.0 DFSR {New-DfsReplicationGroup, Get-DfsReplicationGroup, Set-DfsReplicationGroup, Remove-DfsReplicationGroup...}
Manifest 1.0.0.0 DirectAccessClientComponents {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DAClientExperienceConfiguration, Get-DAEntryPointTableItem...}
Script 3.0 Dism {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability, Add-WindowsImage...}
Manifest 1.0.0.0 DnsClient {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache...}
Manifest 2.0.0.0 DnsServer {Add-DnsServerConditionalForwarderZone, Add-DnsServerDirectoryPartition, Add-DnsServerForwarder, Add-DnsServerPrimaryZone...}
Manifest 1.0.0.0 EventTracingManagement {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTraceSession...}
Binary 1.1.0.0 HPOACmdlets {Add-HPOACertificate, Add-HPOADNS, Add-HPOAEBIPA, Add-HPOAIPv6Address...}
Script 1.1.0.0 IISAdministration {Get-IISAppPool, Start-IISCommitDelay, Stop-IISCommitDelay, Get-IISSite...}
Manifest 2.0.0.0 International {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHomeLocation, Set-WinHomeLocation...}
Manifest 1.0.0.0 iSCSI {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal, Update-IscsiTargetPortal...}
Manifest 2.0.0.0 IscsiTarget {Add-ClusteriSCSITargetServerRole, Add-IscsiVirtualDiskTargetMapping, Checkpoint-IscsiVirtualDisk, Convert-IscsiVirtualDisk...}
Script 1.0.0.0 ISE {New-IseSnippet, Import-IseSnippet, Get-IseSnippet}
Manifest 1.0.0.0 Kds {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration...}
Manifest 1.0.1.0 Microsoft.PowerShell.Archive {Compress-Archive, Expand-Archive}
Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter...}
Manifest 3.0.0.0 Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup...}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-ItemProperty, Join-Path...}
Script 1.0 Microsoft.PowerShell.ODataUtils Export-ODataEndpointProxy
Manifest 3.0.0.0 Microsoft.PowerShell.Security {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential...}
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Format-List, Format-Custom, Format-Table, Format-Wide...}
Manifest 3.0.0.0 Microsoft.WSMan.Management {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig...}
Manifest 1.0 MMAgent {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent...}
Manifest 1.0.0.0 MsDtc {New-DtcDiagnosticTransaction, Complete-DtcDiagnosticTransaction, Join-DtcDiagnosticResourceManager, Receive-DtcDiagnosticTransaction...}
Script 0.0 MS-UPD-Load {Get-UpdCommand, Invoke-Update, Get-UpdXML, Get-Update}
Manifest 2.0.0.0 NetAdapter {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload, Disable-NetAdapterEncapsulatedPacketTaskOffload...}
Manifest 1.0.0.0 NetConnection {Get-NetConnectionProfile, Set-NetConnectionProfile}
Manifest 1.0.0.0 NetDiagnostics Get-NetView
Manifest 1.0.0.0 NetEventPacketCapture {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSession...}
Manifest 2.0.0.0 NetLbfo {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember...}
Manifest 1.0 NetLldpAgent {Enable-NetLldpAgent, Disable-NetLldpAgent, Get-NetLldpAgent}
Manifest 1.0.0.0 NetNat {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession...}
Manifest 2.0.0.0 NetQos {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy}
Manifest 2.0.0.0 NetSecurity {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetIPsecQuickModeCryptoProposal...}
Manifest 1.0.0.0 NetSwitchTeam {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam...}
Manifest 1.0.0.0 NetTCPIP {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol...}
Manifest 1.0.0.0 NetworkConnectivityStatus {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguration, Set-NCSIPolicyConfiguration}
Manifest 1.0.0.0 NetworkControllerDiagnostics {Get-NetworkControllerDeploymentInfo, Get-NetworkControllerManagedDevices, Debug-NetworkController, Debug-NetworkControllerConfigurationState...}
Manifest 1.0.0.0 NetworkSwitchManager {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-NetworkSwitchEthernetPort, Remove-NetworkSwitchEthernetPortIPAddress...}
Manifest 1.0.0.0 NetworkTransition {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHttpsProfile, Disable-NetNatTransitionConfiguration...}
Manifest 1.0 NFS {Get-NfsMappedIdentity, Get-NfsNetgroup, Install-NfsMappingStore, New-NfsMappedIdentity...}
Manifest 1.0.0.0 PcsvDevice {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice...}
Binary 1.0.0.0 PersistentMemory {Get-PmemDisk, Get-PmemPhysicalDevice, Get-PmemUnusedRegion, New-PmemDisk...}
Manifest 1.0.0.0 PKI {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate, Get-CertificateAutoEnrollmentPolicy...}
Manifest 1.0.0.0 PnpDevice {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice}
Script 0.0.6.1 PowerOrion {Add-OrionDiscoveredInterfaces, Get-OrionHostFromSwisConnection, Get-OrionNextAvailableIPAddress, Get-OrionNode...}
Manifest 1.1 PrintManagement {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration...}
Binary 1.0.11 ProcessMitigations {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy}
Script 3.0 Provisioning {Install-ProvisioningPackage, Export-ProvisioningPackage, Install-TrustedProvisioningCertificate, Export-Trace...}
Manifest 1.1 PSDesiredStateConfiguration {Set-DscLocalConfigurationManager, Start-DscConfiguration, Test-DscConfiguration, Publish-DscConfiguration...}
Script 1.0.0.0 PSDiagnostics {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace...}
Binary 1.1.0.0 PSScheduledJob {New-JobTrigger, Add-JobTrigger, Remove-JobTrigger, Get-JobTrigger...}
Manifest 2.0.0.0 PSWorkflow {New-PSWorkflowExecutionOption, New-PSWorkflowSession, nwsn}
Manifest 1.0.0.0 PSWorkflowUtility Invoke-AsWorkflow
Manifest 2.0.0.0 RemoteDesktop {Get-RDCertificate, Set-RDCertificate, New-RDCertificate, New-RDVirtualDesktopDeployment...}
Manifest 1.0.0.0 ScheduledTasks {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-ScheduledTask...}
Manifest 2.0.0.0 SecureBoot {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBootUEFI...}
Script 2.0.0.0 ServerManager {Get-WindowsFeature, Install-WindowsFeature, Uninstall-WindowsFeature, Enable-ServerManagerStandardUserRemoting...}
Cim 1.0.0.0 ServerManagerTasks {Get-SMCounterSample, Get-SMPerformanceCollector, Start-SMPerformanceCollector, Stop-SMPerformanceCollector...}
Manifest 2.0.0.0 SmbShare {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess...}
Manifest 2.0.0.0 SmbWitness {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw...}
Script 21.1.18080 SqlServer {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp, Add-SqlAzureAuthenticationContext...}
Manifest 1.0.0.0 StartLayout {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-StartApps}
Manifest 2.0.0.0 Storage {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDomain...}
Manifest 1.0.0.0 StorageBusCache {Clear-StorageBusDisk, Disable-StorageBusCache, Disable-StorageBusDisk, Enable-StorageBusCache...}
Manifest 2.0.0.0 TLS {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-TlsSessionTicketKey...}
Manifest 1.0.0.0 TroubleshootingPack {Get-TroubleshootingPack, Invoke-TroubleshootingPack}
Manifest 2.0.0.0 TrustedPlatformModule {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm...}
Binary 2.1.639.0 UEV {Clear-UevConfiguration, Clear-UevAppxPackage, Restore-UevBackup, Set-UevTemplateProfile...}
Script 1.0 Unitrends
Manifest 2.0.0.0 VpnClient {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection...}
Manifest 1.0.0.0 Wdac {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn...}
Manifest 1.0.0.0 WebAdministration {Start-WebCommitDelay, Stop-WebCommitDelay, Get-WebConfigurationLock, Remove-WebConfigurationLock...}
Manifest 1.0.0.0 WindowsDeveloperLicense {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-WindowsDeveloperLicenseRegistration}
Script 1.0 WindowsErrorReporting {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorReporting}
Manifest 1.0.0.0 WindowsSearch {Get-WindowsSearchSetting, Set-WindowsSearchSetting}
Manifest 1.0.0.0 WindowsUpdate Get-WindowsUpdateLog
Manifest 1.0.0.2 WindowsUpdateProvider {Get-WUAVersion, Get-WULastInstallationDate, Get-WULastScanSuccessDate, Get-WUIsPendingReboot...}
Directory: C:\Program Files\Hewlett-Packard\PowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.1.0.0 HPOACmdlets {Add-HPOACertificate, Add-HPOADNS, Add-HPOAEBIPA, Add-HPOAIPv6Address...}
Directory: C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Powershell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.0 OperationsManager {Update-SCOMADAgentAssignment, Add-SCOMUserRole, Remove-SCOMNotificationChannel, Get-SCOMErrorReportingSetting...}
Directory: C:\Program Files\Microsoft Monitoring Agent\Agent\PowerShell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0.0.0 Microsoft.MonitoringAgent.PowerS... {Checkpoint-WebApplicationMonitoring, Get-WebApplicationMonitoringStatus, Start-WebApplicationMonitoring, Stop-WebApplicationMonitoring}
Directory: C:\Program Files (x86)\Microsoft SQL Server\140\Tools\PowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 14.0 SQLPS {Backup-SqlDatabase, Save-SqlMigrationReport, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp...}
Directory: C:\Program Files\Microsoft Monitoring Agent\Agent\AzureAutomation\7.3.702.0
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0 HybridRegistration {Add-HybridRunbookWorker, Remove-HybridRunbookWorker, Set-HybridRunbookWorkerSignatureValidation}
Directory: C:\Program Files\Microsoft Monitoring Agent\Agent\AzureAutomation\7.3.702.0\HybridAgent\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0 Orchestrator.AssetManagement.Cmd... {Get-AutomationCertificate, Get-AutomationConnection, Get-SoftwareUpdateConfigurationMachines, Initialize-AutomationSoftwareUpdateConfiguration...}
Directory: C:\Program Files\Pautol\runBooks\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 4.0.4.0 AWSPowerShell.NetCore {Clear-AWSHistory, Set-AWSHistoryConfiguration, Initialize-AWSDefaultConfiguration, Clear-AWSDefaultConfiguration...}
Script 0.9.834 dbatools {Select-DbaObject, Set-DbatoolsConfig, Start-DbaMigration, Copy-DbaDatabase...}
Script 6.2.3 ImportExcel {Add-ConditionalFormatting, Add-ExcelChart, Add-ExcelDataValidationRule, Add-ExcelName...}
Script 5.4.4 ImportExcel {Import-USPS, ConvertFrom-ExcelData, Test-String, Export-MultipleExcelSheets...}
Script 1.7.4.4 PoshRSJob {Get-RSJob, Receive-RSJob, Remove-RSJob, Start-RSJob...}
Script 2.3.1 Selenium {Enter-SeUrl, Find-SeElement, Get-SeCookie, Get-SeElementAttribute...}
Script 21.1.18080 SqlServer {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp, Add-SqlAzureAuthenticationContext...}
Script 6.7.0.1... VMware.Vim
Script 11.5.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Script 11.5.0.... VMware.VimAutomation.Common {Get-Task, Stop-Task, Wait-Task}
Script 11.5.0.... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAdapter, Add-VMHost, Add-VMHostNtpServer...}
Script 11.5.0.... VMware.VimAutomation.Sdk {Get-ErrorReport, Get-PSVersion, Get-InstallPath}
Debug output
pS C:\Program Files\Pautol\Runbooks> Get-AzReservationOrder
Get-AzReservationOrder : Operation returned an invalid status code 'Forbidden'
At line:1 char:1
+ Get-AzReservationOrder
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzReservationOrder], ErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Reservations.Cmdlets.GetReservationOrder
PS C:\Program Files\Pautol\Runbooks> $DebugPreference='Continue'
PS C:\Program Files\Pautol\Runbooks> Get-AzReservation^C
PS C:\Program Files\Pautol\Runbooks> $DebugPreference='Continue'
PS C:\Program Files\Pautol\Runbooks> Get-AzReservationOrder
DEBUG: 12:30:59 - GetReservationOrder begin processing with ParameterSet '__AllParameterSets'.
DEBUG: 12:30:59 - using account id 'd6aaf6c3-5db5-492d-b183-5ca2368279a7'...
DEBUG: [Common.Authentication]: Authenticating using Account: 'd6aaf6c3-5db5-492d-b183-5ca2368279a7', environment: 'AzureCloud', tenant: '5e8f4a34-2bdb-4854-bb42-b4d0c7d0246c'
DEBUG: [Common.Authentication]: Authenticating using configuration values: Domain: '5e8f4a34-2bdb-4854-bb42-b4d0c7d0246c', Endpoint: 'https://login.microsoftonline.com/', ClientId: '1950a258-227b-4e31-a9cf-717495945fc2', ClientRedirect: 'urn:ietf:wg:oauth:2.0:oob', ResourceClientUri: 'https://management.core.windows.net/', ValidateAuthority: 'True'
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5019318Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - 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: 2020-02-27T12:30:59.5019318Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - 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: 2020-02-27T12:30:59.5019318Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: === Token Acquisition started:
CacheType: null
Authentication Target: Client
, Authority Host: login.microsoftonline.com
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: === Token Acquisition started:
Authority: https://login.microsoftonline.com/5e8f4a34-2bdb-4854-bb42-b4d0c7d0246c/
Resource: https://management.core.windows.net/
ClientId: d6aaf6c3-5db5-492d-b183-5ca2368279a7
CacheType: null
Authentication Target: Client
DEBUG: [ADAL]: Verbose: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Verbose: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: Loading from cache.
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 00000000-0000-0000-0000-000000000000 - LoggerBase.cs: Deserialized 1 items to token cache.
DEBUG: [ADAL]: Verbose: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Verbose: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: Looking up cache for a token...
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: An item matching the requested resource was found in the cache
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: 51.0337178433333 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: 51.0337178433333 minutes left until token in cache expires
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: A matching item (access token or refresh token or both) was found in the cache
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 27/02/2020 13:22:01 +00:00
DEBUG: [ADAL]: Information: 2020-02-27T12:30:59.5029294Z: 20730ab7-4d88-4f79-a4a2-d08845072d40 - LoggerBase.cs: === Token Acquisition finished successfully. An access token was returned: Expiration Time: 27/02/2020 13:22:01 +00:00Access Token Hash: sGHROUdWJBi1VsxT+uIzHHMBsRN1NHEa6DWF/Wbao8g=
User id:
DEBUG: [Common.Authentication]: Checking token expiration, token expires '02/27/2020 13:22:01 +00:00' Comparing to '02/27/2020 12:30:59 +00:00' With threshold '00:05:00', calculated time until token expiry: '00:51:02.0220733'
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/providers/Microsoft.Capacity/reservationOrders?api-version=2018-06-01
Headers:
x-ms-client-request-id : bb97ce68-0368-4dd7-a5ed-e579f45a3347
accept-language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
Forbidden
Headers:
Pragma : no-cache
x-ms-failure-cause : gateway
x-ms-request-id : 344bb541-81fa-41b0-9c7a-1364e0ea4088
x-ms-correlation-request-id : 344bb541-81fa-41b0-9c7a-1364e0ea4088
x-ms-routing-request-id : NORTHEUROPE:20200227T123059Z:344bb541-81fa-41b0-9c7a-1364e0ea4088
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Connection : close
Cache-Control : no-cache
Date : Thu, 27 Feb 2020 12:30:59 GMT
Body:
{
"error": {
"code": "AuthorizationFailed",
"message": "The client '1c263673-2127-4d18-88aa-98f5198a9815' with object id '1c263673-2127-4d18-88aa-98f5198a9815' does not have authorization to perform action 'Microsoft.Capacity/reservationOrders/read' over scope '/providers/Microsoft.Capacity' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
}
Get-AzReservationOrder : Operation returned an invalid status code 'Forbidden'
At line:1 char:1
+ Get-AzReservationOrder
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzReservationOrder], ErrorException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Reservations.Cmdlets.GetReservationOrder
DEBUG: AzureQoSEvent: CommandName - Get-AzReservationOrder; IsSuccess - False; Duration - 00:00:00.1759349;; Exception - Microsoft.Azure.Management.Reservations.Models.ErrorException: Operation returned an invalid status code 'Forbidden'
at Microsoft.Azure.Management.Reservations.ReservationOrderOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.<ListAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.List(IReservationOrderOperations operations)
at Microsoft.Azure.Commands.Reservations.Cmdlets.GetReservationOrder.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord();
DEBUG: Finish sending metric.
DEBUG: 12:31:00 - GetReservationOrder end processing.
Error output
PS C:\Program Files\Pautol\Runbooks> resolve-azerror
DEBUG: 12:35:29 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 12:35:29 - using account id 'd6aaf6c3-5db5-492d-b183-5ca2368279a7'...
WARNING: Breaking changes in the cmdlet 'Resolve-AzError' :
WARNING: - The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
WARNING: NOTE : Go to https://aka.ms/azps-changewarnings for steps to suppress this breaking change warning, and other information on breaking changes in Azure PowerShell.
HistoryId: 17
Message : Operation returned an invalid status code 'Forbidden'
StackTrace : at Microsoft.Azure.Management.Reservations.ReservationOrderOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.<ListAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.List(IReservationOrderOperations operations)
at Microsoft.Azure.Commands.Reservations.Cmdlets.GetReservationOrder.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : Microsoft.Azure.Management.Reservations.Models.ErrorException
InvocationInfo : {Get-AzReservationOrder}
Line : Get-AzReservationOrder
Position : At line:1 char:1
+ Get-AzReservationOrder
+ ~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 17
HistoryId: 14
Message : Operation returned an invalid status code 'Forbidden'
StackTrace : at Microsoft.Azure.Management.Reservations.ReservationOrderOperations.<ListWithHttpMessagesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.<ListAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Management.Reservations.ReservationOrderOperationsExtensions.List(IReservationOrderOperations operations)
at Microsoft.Azure.Commands.Reservations.Cmdlets.GetReservationOrder.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : Microsoft.Azure.Management.Reservations.Models.ErrorException
InvocationInfo : {Get-AzReservationOrder}
Line : Get-AzReservationOrder
Position : At line:1 char:1
+ Get-AzReservationOrder
+ ~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 14
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc
The correct permission needs to be checked by service team. Include Reservations team.
I have a call lgged also thanks. But surely 'Owner' permission is enough?
Not quite the same issue, but similar, and it's what I got a hit on when searching for my problem, and could give hints as to where the issue lies.
I can view reservations in the Azure portal, and have Owner on the relevant subscriptions, but can't see them with these Cmdlets. I can see that portal is calling
https://management.azure.com/api/invoke
with
x-ms-path-query: /providers/Microsoft.Capacity/reservations?api-version=2019-04-01
and gets a list of reservations.
but for me
armclient get /providers/microsoft.capacity/reservationOrders?api-version=2019-04-01
gives
{ "value": [] }
and
armclient get /providers/microsoft.capacity/reservationOrders/<guid>?api-version=2019-04-01
gives
{
"error": {
"code": "AuthorizationFailed",
"message": "The client '[email protected]' with object id '<guid>' does not have authorization to perform action 'microsoft.capacity/reservationOrders/read' over scope '/providers/microsoft.capacity/reservationOrders/<guid>' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
}
So my symptoms are the same as https://github.com/Azure/azure-libraries-for-net/issues/454
I can confirm that this issue still exists as of today on version 0.8.2 of the Az.Reservations module. In trying to retrieve a list of reservations with Get-AZReservation -ReservationOrderID $id returns forbidden on three of our reservations. The account being used has owner permissions on all subscriptions.
I did speak to support reagding this and they confirmed its a permissions issue. When calling the cmdlet the user either has to be an EA, or own the actual reservation.
So running under a user which has owner on the subscription, but not the rservation, will generate the error. Not sure why its this way, but thats the answer I recieved and my testing confirmed this,
I faced the same problem, it is a permission issue, if you don't have access to reservation orders, you will get this error. just verify if you have access to reservation orders which is inside the reservation.
if you have access to a reservation, you will get output when you run the Get-AzReservation -ReservationOrderId "XXXXXXXX", but you will get forbidden error when you run the below command Get-AzReservationOrder -ReservationOrderId "XXXXXX", because you have access to reservation not reservationorder
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @ms-premp.
Service Principal is not supported on these APIs. Only user AD credentials are supported.
Closing as its an unsupported scenario.
I am an owner on our subscription and owner of the reservation, and using version 0.9.0 of the module. When logging in using my AD credentials, I get:
Get-AzReservation: Operation returned an invalid status code 'Forbidden'
@ramaganesan-rg @ms-premp does this need reopening?
Hello :)
I am both owner of subscription, and reservation order. And also enterprise administrator on ea.azure.com
I can see the reservation order in azure portal.
The cmdlet get-azreservationorder returns "403 forbidden" for all reservation orders. The API returns a null result when listing all reservation orders or also a "forbidden" when getting a specific one.
How is this not supported ? I'm using my account to perform this, not a SP, and I can't get anything done with reservations at the moment...
@ms-premp I cannot understand, why Service Principals are not supported! This is an urgent requirement for Management Reports.
Powershell works fine:

Azure Automation - breaks:

@ms-premp any update on this issue? we experience the same thing.. using AAD user for authentication, but both Az CLI and Powershell fail with the same error:
does not have authorization to perform action 'Microsoft.Capacity/reservationOrders/reservations/read'
even-though the user has Owner role.