Azure / Azure/azure-powershell

Get-AzMetric returns no data

Open
#20,044 5 comments 0 reactions 0 assignees View on GitHub
act-observability-squad bug customer-reported Monitor - Metrics needs-team-attention
Dominant language
C#
Stars
4.8k
Forks
4.3k
Avg merge
2d 17h
Merged PRs (30d)
51

Description

### Description

This DOES work from the Azure Portal CLI. Just not from any of the VMs and I need to run it on the VMs as part of a scheduled task. I tried capturing the results in a variable and outputting .Data.Average property (per https://github.com/Azure/azure-powershell/issues/8970), but that doesn't work either for me. I've already spent 4 hours on this with no results. Yes, I've completely uninstalled and re-installed the Az Module and rebooted several times. Please help.

### Issue script & Debug output

```PowerShell
PS C:\windows\system32> Get-AzMetric -ResourceId "/subscriptions/4b0ebbb1-8954-4435-b8c0-cc53cf67ff79/resourceGroups/fuzevms/providers/Microsoft.Compute/virtualMachines/$webserver" -TimeGrain $timeg -StartTime $st -EndTime $et -MetricNames 'CPU Credits Remaining'
DEBUG: 10:30:54 PM - GetAzureRmMetricCommand begin processing with ParameterSet 'GetWithDefaultParameters'.
DEBUG: 10:30:54 PM - using account id '157b2702-9de2-4d40-978a-dbf52b7f5616'...
DEBUG: 10:30:54 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: 10:30:54 PM - *** The namespace for all the model classes will change from Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.
WARNING: 10:30:54 PM - *** The namespace for output classes will be uniform for all classes in future releases to make it independent of modifications in the model classes.
WARNING: [Get-AzMetric] Parameter deprecation: The DetailedOutput parameter will be deprecated in a future breaking change release.
DEBUG: [Common.Authentication]: Authenticating using Account: '157b2702-9de2-4d40-978a-dbf52b7f5616', environment: 'AzureCloud', tenant: '8581def8-8768-483c-8b78-f5d69117e15a'
DEBUG: 10:30:54 PM - [ServicePrincipalAuthenticator] Calling ClientSecretCredential.GetTokenAsync - ApplicationId:'157b2702-9de2-4d40-978a-dbf52b7f5616', TenantId:'8581def8-8768-483c-8b78-f5d69117e15a', Scopes:'https://management.core.windows.net
//.default', AuthorityHost:'https://login.microsoftonline.com/'
DEBUG: ClientSecretCredential.GetToken invoked. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId:
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] MSAL MSAL.Desktop with assembly version '4.46.0.0'. CorrelationId(c775ccd1-e306-4835-94e8-0f351654c4
d6)
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] === AcquireTokenForClientParameters ===
SendX5C: False
ForceRefresh: False

DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6]
=== Request Data ===
Authority Provided? - True
Scopes - https://management.core.windows.net//.default
Extra Query Params Keys (space separated) -
ApiId - AcquireTokenForClient
IsConfidentialClient - True
SendX5C - False
LoginHint ? False
IsBrokerConfigured - False
HomeAccountId - False
CorrelationId - c775ccd1-e306-4835-94e8-0f351654c4d6
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured:

DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] === Token Acquisition (ClientCredentialRequest) started:
Scopes: https://management.core.windows.net//.default
Authority Host: login.microsoftonline.com
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] [Region discovery] Not using a regional authority.
DEBUG: Request [ee008e90-cff8-4da0-a627-92c02a51093d] POST https://login.microsoftonline.com/8581def8-8768-483c-8b78-f5d69117e15a/oauth2/v2.0/token
x-client-SKU:REDACTED
x-client-Ver:REDACTED
x-client-CPU:REDACTED
x-client-OS:REDACTED
x-client-current-telemetry:REDACTED
x-client-last-telemetry:REDACTED
x-ms-lib-capability:REDACTED
client-request-id:REDACTED
return-client-request-id:REDACTED
x-app-name:REDACTED
x-app-ver:REDACTED
Content-Type:application/x-www-form-urlencoded
x-ms-client-request-id:ee008e90-cff8-4da0-a627-92c02a51093d
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Identity/1.6.1 (.NET Framework 4.8.4515.0; Microsoft Windows 10.0.17763 )
client assembly: Azure.Identity
DEBUG: Response [ee008e90-cff8-4da0-a627-92c02a51093d] 200 OK (00.3s)
Pragma:no-cache
Strict-Transport-Security:REDACTED
X-Content-Type-Options:REDACTED
client-request-id:REDACTED
x-ms-request-id:f460b5fe-02ed-4987-bb62-b1de3b49b100
x-ms-ests-server:REDACTED
x-ms-clitelem:REDACTED
X-XSS-Protection:REDACTED
Cache-Control:no-store, no-cache
Content-Type:application/json; charset=utf-8
Expires:-1
P3P:REDACTED
Set-Cookie:REDACTED
Date:Mon, 07 Nov 2022 22:30:54 GMT
Content-Length:1379

DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] ScopeSet was missing from the token response, so using developer provided scopes in the result.
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Checking client info returned from the server..
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Saving token response to cache..
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] ID Token not present in response.
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Cannot determine home account id - or id token or no client info and no subject
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Saving AT in cache and removing overlapping ATs...
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Looking for scopes for the authority in the cache which intersect with https://management.core.windo
ws.net//.default
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Intersecting scope entries count - 0
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6]
=== Token Acquisition finished successfully:
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] AT expiration time: 11/7/2022 11:30:53 PM +00:00, scopes: https://management.core.windows.net//.def
ault. source: IdentityProvider
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2019 Datacenter [2022-11-07 22:30:54Z - c775ccd1-e306-4835-94e8-0f351654c4d6] Fetched access token from host login.microsoftonline.com.
DEBUG: ClientSecretCredential.GetToken succeeded. Scopes: [ https://management.core.windows.net//.default ] ParentRequestId: ExpiresOn: 2022-11-07T23:30:53.3384624+00:00
DEBUG: [Common.Authentication]: Received token with LoginType 'User', Tenant: '8581def8-8768-483c-8b78-f5d69117e15a', UserId: '157b2702-9de2-4d40-978a-dbf52b7f5616'
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://management.azure.com//subscriptions/4b0ebbb1-8954-4435-b8c0-cc53cf67ff79/resourceGroups/fuzevms/providers/Microsoft.Compute/virtualMachines/fuzeweb01/providers/Microsoft.Insights/metrics?timespan=2022-11-07T22:06:31.7960428Z%2F2022-11-07T
22:07:31.8050114Z&interval=PT1M&metricnames=CPU Credits Remaining&api-version=2018-01-01

Headers:
x-ms-client-request-id : 1b67d613-2deb-4359-8856-10182d9994cc
accept-language : en-US

Body:

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

Status Code:
OK

Headers:
Pragma : no-cache
x-ms-request-id : e576df24-985d-4b52-858f-e37a4f7dd271
x-ms-correlation-request-id : e576df24-985d-4b52-858f-e37a4f7dd271
x-ms-routing-request-id : WESTUS:20221107T223054Z:e576df24-985d-4b52-858f-e37a4f7dd271
Strict-Transport-Security : max-age=31536000; includeSubDomains
X-Content-Type-Options : nosniff
Cache-Control : no-cache
Date : Mon, 07 Nov 2022 22:30:53 GMT

Body:
{
"value": []
}

DEBUG: 10:30:54 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Monitor:4.2.0; CommandName: Get-AzMetric; PSVersion: 5.1.17763.2931; IsSuccess: True; Duration: 00:00:00.5116889
DEBUG: 10:30:54 PM - GetAzureRmMetricCommand end processing.
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.17763.2931
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.2931
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 9.1.0 Az
Script 2.10.3 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}
Script 2.0.0 Az.Advisor {Disable-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Get-AzAdvisorConfiguration, Get-AzAdvisorRecommendation...}
Script 5.0.0 Az.Aks {Disable-AzAksAddOn, Enable-AzAksAddOn, Get-AzAksCluster, Get-AzAksNodePool...}
Script 1.1.4 Az.AnalysisServices {Add-AzAnalysisServicesAccount, Export-AzAnalysisServicesInstanceLog, Get-AzAnalysisServicesServer, New-AzAnalysisServicesFirewallConfig...}
Script 4.0.0 Az.ApiManagement {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion...}
Script 1.2.0 Az.AppConfiguration {Clear-AzAppConfigurationDeletedStore, Get-AzAppConfigurationDeletedStore, Get-AzAppConfigurationStore, Get-AzAppConfigurationStoreKey...}
Script 2.1.0 Az.ApplicationInsights {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKey, Get-AzApplicationInsightsContinuousExport, Get-AzApplicationInsightsLinkedStorageAccount...}
Script 2.0.0 Az.Attestation {Add-AzAttestationPolicySigner, Get-AzAttestationPolicy, Get-AzAttestationPolicySigners, Remove-AzAttestationPolicySigner...}
Script 1.8.0 Az.Automation {Export-AzAutomationDscConfiguration, Export-AzAutomationDscNodeReportContent, Export-AzAutomationRunbook, Get-AzAutomationAccount...}
Script 3.2.1 Az.Batch {Disable-AzBatchAutoScale, Disable-AzBatchComputeNodeScheduling, Disable-AzBatchJob, Disable-AzBatchJobSchedule...}
Script 2.0.0 Az.Billing {Get-AzBillingAccount, Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzBillingProfile...}
Script 2.1.0 Az.Cdn {Clear-AzCdnEndpointContent, Clear-AzFrontDoorCdnEndpointContent, Disable-AzCdnCustomDomainCustomHttps, Enable-AzCdnCustomDomainCustomHttps...}
Script 1.1.0 Az.CloudService {Get-AzCloudService, Get-AzCloudServiceInstanceView, Get-AzCloudServiceNetworkInterface, Get-AzCloudServiceOSFamily...}
Script 1.12.0 Az.CognitiveServices {Add-AzCognitiveServicesAccountNetworkRule, Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountCommitmentPlan, Get-AzCognitiveServicesAccountDeployment...}
Script 5.1.0 Az.Compute {Add-AzImageDataDisk, Add-AzVhd, Add-AzVMAdditionalUnattendContent, Add-AzVMDataDisk...}
Script 1.0.0 Az.ConfidentialLedger {Get-AzConfidentialLedger, New-AzConfidentialLedger, New-AzConfidentialLedgerAADBasedSecurityPrincipalObject, New-AzConfidentialLedgerCertBasedSecurityPrincipalObject...}
Script 3.1.0 Az.ContainerInstance {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability...}
Script 3.0.0 Az.ContainerRegistry {Connect-AzContainerRegistry, Get-AzContainerRegistry, Get-AzContainerRegistryCredential, Get-AzContainerRegistryManifest...}
Script 1.8.2 Az.CosmosDB {Get-AzCosmosDBAccount, Get-AzCosmosDBAccountKey, Get-AzCosmosDBCassandraKeyspace, Get-AzCosmosDBCassandraKeyspaceThroughput...}
Script 1.1.0 Az.DataBoxEdge {Get-AzDataBoxEdgeBandwidthSchedule, Get-AzDataBoxEdgeDevice, Get-AzDataBoxEdgeJob, Get-AzDataBoxEdgeOrder...}
Script 1.4.0 Az.Databricks {Get-AzDatabricksAccessConnector, Get-AzDatabricksOutboundNetworkDependenciesEndpoint, Get-AzDatabricksVNetPeering, Get-AzDatabricksWorkspace...}
Script 1.16.10 Az.DataFactory {Add-AzDataFactoryV2DataFlowDebugSessionPackage, Add-AzDataFactoryV2TriggerSubscription, Get-AzDataFactory, Get-AzDataFactoryActivityWindow...}
Script 1.0.2 Az.DataLakeAnalytics {Add-AzDataLakeAnalyticsDataSource, Add-AzDataLakeAnalyticsFirewallRule, Get-AzDataLakeAnalyticsAccount, Get-AzDataLakeAnalyticsCatalogItem...}
Script 1.3.0 Az.DataLakeStore {Add-AzDataLakeStoreFirewallRule, Add-AzDataLakeStoreItemContent, Add-AzDataLakeStoreTrustedIdProvider, Add-AzDataLakeStoreVirtualNetworkRule...}
Script 1.0.0 Az.DataProtection {Backup-AzDataProtectionBackupInstanceAdhoc, Edit-AzDataProtectionPolicyRetentionRuleClientObject, Edit-AzDataProtectionPolicyTagClientObject, Edit-AzDataProtectionPolicyTriggerClientO...
Script 1.0.1 Az.DataShare {Get-AzDataShare, Get-AzDataShareAccount, Get-AzDataShareDataSet, Get-AzDataShareDataSetMapping...}
Script 1.1.0 Az.DeploymentManager {Get-AzDeploymentManagerArtifactSource, Get-AzDeploymentManagerRollout, Get-AzDeploymentManagerService, Get-AzDeploymentManagerServiceTopology...}
Script 3.1.1 Az.DesktopVirtualization {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-AzWvdApplication, Get-AzWvdApplicationGroup...}
Script 1.0.2 Az.DevTestLabs {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}
Script 1.1.2 Az.Dns {Add-AzDnsRecordConfig, Get-AzDnsRecordSet, Get-AzDnsZone, New-AzDnsRecordConfig...}
Script 1.5.0 Az.EventGrid {Enable-AzEventGridPartnerTopic, Get-AzEventGridChannel, Get-AzEventGridDomain, Get-AzEventGridDomainKey...}
Script 3.1.0 Az.EventHub {Add-AzEventHubIPRule, Add-AzEventHubVirtualNetworkRule, Get-AzEventHubNamespace, New-AzEventHubAuthorizationRuleSASToken...}
Script 1.9.0 Az.FrontDoor {Disable-AzFrontDoorCustomDomainHttps, Enable-AzFrontDoorCustomDomainHttps, Get-AzFrontDoor, Get-AzFrontDoorFrontendEndpoint...}
Script 4.0.6 Az.Functions {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Get-AzFunctionAppPlan, Get-AzFunctionAppSetting...}
Script 5.0.1 Az.HDInsight {Add-AzHDInsightClusterIdentity, Add-AzHDInsightComponentVersion, Add-AzHDInsightConfigValue, Add-AzHDInsightMetastore...}
Script 2.0.0 Az.HealthcareApis {Get-AzHealthcareApisService, Get-AzHealthcareApisWorkspace, Get-AzHealthcareDicomService, Get-AzHealthcareFhirDestination...}
Script 2.7.4 Az.IotHub {Add-AzIotHubCertificate, Add-AzIotHubConfiguration, Add-AzIotHubDeployment, Add-AzIotHubDevice...}
Script 4.9.0 Az.KeyVault {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAccount...}
Script 2.1.0 Az.Kusto {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabasePrincipal, Get-AzKustoAttachedDatabaseConfiguration, Get-AzKustoCluster...}
Script 1.5.0 Az.LogicApp {Get-AzIntegrationAccount, Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBatchConfiguration...}
Script 1.1.3 Az.MachineLearning {Add-AzMlWebServiceRegionalProperty, Export-AzMlWebService, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlan...}
Script 1.2.0 Az.Maintenance {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenancePublicConfiguration...}
Script 1.1.0 Az.ManagedServiceIdentity {Get-AzFederatedIdentityCredentials, Get-AzSystemAssignedIdentity, Get-AzUserAssignedIdentity, Get-AzUserAssignedIdentityAssociatedResource...}
Script 3.0.0 Az.ManagedServices {Get-AzManagedServicesAssignment, Get-AzManagedServicesDefinition, Get-AzManagedServicesMarketplaceDefinition, New-AzManagedServicesAssignment...}
Script 2.0.0 Az.MarketplaceOrdering {Get-AzMarketplaceTerms, Invoke-AzMarketplaceSignTerms, Set-AzMarketplaceTerms, Stop-AzMarketplaceTerms}
Script 1.1.1 Az.Media {Get-AzMediaService, Get-AzMediaServiceKey, Get-AzMediaServiceNameAvailability, New-AzMediaService...}
Script 2.1.0 Az.Migrate {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMigrateProject, Get-AzMigrateReplicationFabric...}
Script 4.2.0 Az.Monitor {Add-AzLogProfile, Add-AzMetricAlertRule, Add-AzMetricAlertRuleV2, Add-AzWebtestAlertRule...}
Script 1.1.0 Az.MySql {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Get-AzMySqlFirewallRule, Get-AzMySqlFlexibleServer...}
Script 5.1.0 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayBackendSetting...}
Script 1.1.1 Az.NotificationHubs {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotificationHubPNSCredential...}
Script 3.2.0 Az.OperationalInsights {Disable-AzOperationalInsightsIISLogCollection, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsightsLinuxPerformanceCollection, Disable-AzOperationalIns...
Script 1.5.1 Az.PolicyInsights {Get-AzPolicyEvent, Get-AzPolicyMetadata, Get-AzPolicyRemediation, Get-AzPolicyState...}
Script 1.1.0 Az.PostgreSql {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnectionString, Get-AzPostgreSqlFirewallRule, Get-AzPostgreSqlFlexibleServer...}
Script 1.2.0 Az.PowerBIEmbedded {Get-AzPowerBIEmbeddedCapacity, Get-AzPowerBIWorkspace, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollectionAccessKey...}
Script 1.0.3 Az.PrivateDns {Add-AzPrivateDnsRecordConfig, Get-AzPrivateDnsRecordSet, Get-AzPrivateDnsVirtualNetworkLink, Get-AzPrivateDnsZone...}
Script 6.1.0 Az.RecoveryServices {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Backup-AzRecoveryServicesBackupItem, Copy-AzRecoveryServicesVault, Disable-AzRecoveryServicesBackupAutoProtection...}
Script 1.6.0 Az.RedisCache {Export-AzRedisCache, Get-AzRedisCache, Get-AzRedisCacheFirewallRule, Get-AzRedisCacheKey...}
Script 1.1.0 Az.RedisEnterpriseCache {Export-AzRedisEnterpriseCache, Get-AzRedisEnterpriseCache, Get-AzRedisEnterpriseCacheDatabase, Get-AzRedisEnterpriseCacheKey...}
Script 1.0.3 Az.Relay {Get-AzRelayAuthorizationRule, Get-AzRelayHybridConnection, Get-AzRelayKey, Get-AzRelayNamespace...}
Script 1.1.0 Az.ResourceMover {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveCollection, Get-AzResourceMoverMoveResource, Get-AzResourceMoverRequiredForResources...}
Script 6.4.0 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}
Script 1.3.0 Az.Security {Add-AzSecurityAdaptiveNetworkHardening, Add-AzSecuritySqlVulnerabilityAssessmentBaseline, Confirm-AzSecurityAutomation, Disable-AzIotSecurityAnalyticsAggregatedAlert...}
Script 3.0.0 Az.SecurityInsights {Get-AzSentinelAlertRule, Get-AzSentinelAlertRuleAction, Get-AzSentinelAlertRuleTemplate, Get-AzSentinelAutomationRule...}
Script 2.0.0 Az.ServiceBus {Add-AzServiceBusIPRule, Add-AzServiceBusVirtualNetworkRule, Get-AzServiceBusNamespace, Get-AzServiceBusOperation...}
Script 3.1.0 Az.ServiceFabric {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricManagedClusterClientCertificate, Add-AzServiceFabricManagedNodeTypeVMExtension, Add-AzServiceFabricManagedNodeTypeVMSecret...}
Script 1.4.1 Az.SignalR {Get-AzSignalR, Get-AzSignalRKey, Get-AzSignalRUsage, New-AzSignalR...}
Script 4.1.0 Az.Sql {Add-AzSqlDatabaseToFailoverGroup, Add-AzSqlElasticJobStep, Add-AzSqlElasticJobTarget, Add-AzSqlInstanceKeyVaultKey...}
Script 1.1.0 Az.SqlVirtualMachine {Get-AzAvailabilityGroupListener, Get-AzSqlVM, Get-AzSqlVMGroup, New-AzAvailabilityGroupListener...}
Script 1.3.2 Az.StackHCI {Add-AzStackHCIVMAttestation, Disable-AzStackHCIAttestation, Disable-AzStackHCIRemoteSupport, Enable-AzStackHCIAttestation...}
Script 5.1.0 Az.Storage {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle...}
Script 1.7.0 Az.StorageSync {Get-AzStorageSyncCloudEndpoint, Get-AzStorageSyncGroup, Get-AzStorageSyncServer, Get-AzStorageSyncServerEndpoint...}
Script 2.0.0 Az.StreamAnalytics {Get-AzStreamAnalyticsCluster, Get-AzStreamAnalyticsClusterStreamingJob, Get-AzStreamAnalyticsDefaultFunctionDefinition, Get-AzStreamAnalyticsFunction...}
Script 1.0.0 Az.Support {Get-AzSupportProblemClassification, Get-AzSupportService, Get-AzSupportTicket, Get-AzSupportTicketCommunication...}
Script 2.0.0 Az.Synapse {Add-AzSynapseDataFlowDebugSessionPackage, Add-AzSynapseTriggerSubscription, Clear-AzSynapseSqlPoolVulnerabilityAssessmentRuleBaseline, Convert-AzSynapseSqlPoolVulnerabilityAssessmentS...
Script 1.1.0 Az.TrafficManager {Add-AzTrafficManagerCustomHeaderToEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Add-AzTrafficManagerEndpointConfig, Add-AzTrafficManagerExpectedStatusCodeRange...}
Script 2.11.5 Az.Websites {Add-AzWebAppAccessRestrictionRule, Add-AzWebAppTrafficRouting, Edit-AzWebAppBackupConfiguration, Enter-AzWebAppContainerPSSession...}
```

### Error output

```PowerShell
DEBUG: 10:32:47 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 10:32:47 PM - using account id '157b2702-9de2-4d40-978a-dbf52b7f5616'...
DEBUG: 10:32:47 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
WARNING: Upcoming breaking changes in the cmdlet 'Resolve-AzError' :
The `Resolve-Error` alias will be removed in a future release. Please change any scripts that use this alias to use `Resolve-AzError` instead.
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: 10

Message : Exception type: ErrorResponseException, Message: Microsoft.Azure.Management.Monitor.Models.ErrorResponseException: Operation returned an invalid status code 'NotFound'
at Microsoft.Azure.Management.Monitor.MetricsOperations.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.Monitor.MetricsOperationsExtensions.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.Commands.Insights.Metrics.GetAzureRmMetricCommand.ProcessRecordInternal()
at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet(), Code: Null, Status code:Null, Reason phrase: Null
StackTrace : at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet()
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception : System.Management.Automation.PSInvalidOperationException
InvocationInfo : {Get-AzMetric}
Line : $creditsRemaining = (Get-AzMetric -ResourceId "/subscriptions/4b0ebbb1-8954-4435-b8c0-cc53cf67ff79/resourceGroups/fuzevms/providers/Microsoft.Compute/virtualMachines/$webserver" -TimeGrain $timeg -StartTime $st -EndTime $et
-MetricNames 'CPU Credits Remaining').Data.Average
Position : At line:1 char:22
+ ... emaining = (Get-AzMetric -ResourceId "/subscriptions/4b0ebbb1-8954-44 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 10

Message : Operation returned an invalid status code 'NotFound'
StackTrace : at Microsoft.Azure.Management.Monitor.MetricsOperations.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.Monitor.MetricsOperationsExtensions.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.Commands.Insights.Metrics.GetAzureRmMetricCommand.ProcessRecordInternal()
at Microsoft.Azure.Commands.Insights.MonitorCmdletBase.ExecuteCmdlet()
Exception : Microsoft.Azure.Management.Monitor.Models.ErrorResponseException
InvocationInfo : {Get-AzMetric}
Line : $creditsRemaining = (Get-AzMetric -ResourceId "/subscriptions/4b0ebbb1-8954-4435-b8c0-cc53cf67ff79/resourceGroups/fuzevms/providers/Microsoft.Compute/virtualMachines/$webserver" -TimeGrain $timeg -StartTime $st -EndTime $et
-MetricNames 'CPU Credits Remaining').Data.Average
Position : At line:1 char:22
+ ... emaining = (Get-AzMetric -ResourceId "/subscriptions/4b0ebbb1-8954-44 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 10

HistoryId: 3

Message : Cannot find a variable with the name 'SetDefaultValueParameterWarningMessage'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'DefaultFunctionsVersion'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'RequiredStorageEndpoints'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'ReservedFunctionAppSettingNames'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'RuntimeToDefaultOSType'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'AllowedStorageTypes'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'SupportedFunctionsVersion'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'FunctionsNoV2Version'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

Message : Cannot find a variable with the name 'RuntimeToFormattedName'.
StackTrace :
Exception : System.Management.Automation.ItemNotFoundException
InvocationInfo : {Get-Variable}
Line : if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue))

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.6\custom\HelperFunctions.ps1:49 char:15
+ ... if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

HistoryId: -1

Message : At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:156 char:19
+ | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.S ...
+ ~
An empty pipe element is not allowed.

At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:180 char:15
+ | Where-Object { ($_.Scope -eq $DataSourceId -or $_.Sco ...
+ ~
An empty pipe element is not allowed.

At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:204 char:15
+ | Where-Object { ($_.Scope -eq $SnapshotResourceGroupId ...
+ ~
An empty pipe element is not allowed.
StackTrace : at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior
errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.b__0()
at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo
invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Exception : System.Management.Automation.ParseException
InvocationInfo : {}
Line : | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.Scope -eq $KeyvaultRG -or $_.Scope -eq $KeyvaultSubscription) -and $_.RoleDefinitionName -eq $Permission}

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:156 char:19
+ | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.S ...
+ ~
HistoryId : -1

Message : At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:156 char:19
+ | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.S ...
+ ~
An empty pipe element is not allowed.

At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:180 char:15
+ | Where-Object { ($_.Scope -eq $DataSourceId -or $_.Sco ...
+ ~
An empty pipe element is not allowed.

At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:204 char:15
+ | Where-Object { ($_.Scope -eq $SnapshotResourceGroupId ...
+ ~
An empty pipe element is not allowed.
StackTrace : at System.Management.Automation.ScriptBlock.Create(Parser parser, String fileName, String fileContents)
at System.Management.Automation.ExternalScriptInfo.ParseScriptContents(Parser parser, String fileName, String fileContents, Nullable`1 definingLanguageMode)
at System.Management.Automation.ExternalScriptInfo.get_ScriptBlock()
at System.Management.Automation.CommandDiscovery.CreateCommandProcessorForScript(ExternalScriptInfo scriptInfo, ExecutionContext context, Boolean useNewScope, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.CreateScriptProcessorForSingleShell(ExternalScriptInfo scriptInfo, ExecutionContext context, Boolean useLocalScope, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(CommandInfo commandInfo, CommandOrigin commandOrigin, Nullable`1 useLocalScope, SessionStateInternal sessionState)
at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections, ExecutionContext context)
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)
Exception : System.Management.Automation.ParseException
InvocationInfo : {}
Line : | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.Scope -eq $KeyvaultRG -or $_.Scope -eq $KeyvaultSubscription) -and $_.RoleDefinitionName -eq $Permission}

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.DataProtection\1.0.0\custom\Cmdlets\Platform\Vault\Set-AzDataProtectionMSIPermission.ps1:156 char:19
+ | Where-Object { ($_.Scope -eq $KeyVaultId -or $_.S ...
+ ~
HistoryId : -1

HistoryId: 3

Message : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
StackTrace : at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)
at Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
Exception : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line : Add-Type -Path $_.FullName -ErrorAction Ignore | Out-Null

Position : At C:\Program Files\WindowsPowerShell\Modules\Az.Compute\5.1.0\Az.Compute.psm1:39 char:21
+ ... Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 3

The Azure PowerShell team is listening, please let us know how we are doing: https://aka.ms/azpssurvey?Q_CHL=ERROR.

DEBUG: 10:32:47 PM - [ConfigManager] Got [True] from [EnableDataCollection], Module = [], Cmdlet = [].
DEBUG: AzureQoSEvent: Module: Az.Accounts:2.10.3; CommandName: Resolve-AzError; PSVersion: 5.1.17763.2931; IsSuccess: True; Duration: 00:00:00.4305257
DEBUG: 10:32:47 PM - ResolveError end processing.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.