Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.24k stars 3.84k forks source link

Error upon Import-Module #23952

Closed init5-SF closed 9 months ago

init5-SF commented 9 months ago

Description

I have installed the latest version of the Az PowerShell module from the PowerShell Gallery. ` When I runimport-module Az` I get the bellow error image

Issue script & Debug output

PS C:\Users\dev\Desktop> $DebugPreference='Continue'
PS C:\Users\dev\Desktop> Import-Module Az
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.22621.2506].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\2.15.0\StartupScripts\..\lib].
WARNING: The names of some imported commands from the module 'Az.DevCenterdata.custom' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.DevCenter' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module
command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
DEBUG: [Stacks API] -  Build function stack definitions.
DEBUG: Got version 0 of Az
DEBUG: Got version 0 of Az.Accounts
DEBUG: 12:07:26 AM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.15.0; CommandName: Get-AzContext; PSVersion: 5.1.22621.2506; IsSuccess: True; Duration: 00:00:00.0599608
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - GetAzureRMContextCommand end processing.
Get-ChildItem : There is no active Azure PowerShell session. Please run 'Connect-AzAccount'
At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.7\custom\Az.Functions.custom.psm1:15 char:3
+   Get-ChildItem -Path $PSScriptRoot -Recurse -Include '*.ps1' -File | ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-ChildItem], InvalidOperationException
    + FullyQualifiedErrorId : LoginToAzureViaConnectAzAccount,Microsoft.PowerShell.Commands.GetChildItemCommand

DEBUG: [Stacks API] -  Build function stack definitions.
DEBUG: 12:07:26 AM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.15.0; CommandName: Get-AzContext; PSVersion: 5.1.22621.2506; IsSuccess: True; Duration: 00:00:00.0074718
DEBUG: 12:07:26 AM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 12:07:26 AM - GetAzureRMContextCommand end processing.
CmdletProviderInvocationException: There is no active Azure PowerShell session. Please run 'Connect-AzAccount'
   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.<InvokeWithPipe>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.DoInvokeReturnAsIs(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
   at System.Management.Automation.CommandInvocationIntrinsics.InvokeScript(ScriptBlock sb, Boolean useNewScope, PipelineResultTypes writeToPipeline, IList input, Object[] args)
   at Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.PowerShell.PsHelpers.RunScript[T](CommandInvocationIntrinsics cii, String script)
   at Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.PowerShell.PsHelpers.GetScriptCmdlets(PSCmdlet cmdlet, String scriptFolder)
   at Microsoft.Azure.PowerShell.Cmdlets.Functions.Runtime.PowerShell.GetScriptCmdlet.ProcessRecord()
Get-ChildItem : There is no active Azure PowerShell session. Please run 'Connect-AzAccount'
At line:3 char:1
+ Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules\Az.Fu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Get-ChildItem], InvalidOperationException
    + FullyQualifiedErrorId : LoginToAzureViaConnectAzAccount,Microsoft.PowerShell.Commands.GetChildItemCommand

WARNING: The names of some imported commands from the module 'Microsoft.Azure.PowerShell.Cmdlets.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved
verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.Network' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module
command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.NetworkCloud.private' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.NetworkCloud.private' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.NetworkCloud.private' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
WARNING: The names of some imported commands from the module 'Az.NetworkCloud' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the
Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
PS C:\Users\dev\Desktop>

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                                                                                                                                                                  
---------- -------    ----                                ----------------                                                                                                                                                                  
Script     11.2.0     az                                                                                                                                                                                                                    
Script     2.15.0     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     6.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.2      Az.ApiManagement                    {Add-AzApiManagementApiToGateway, Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion...}                                               
Script     1.0.0      Az.App                              {Disable-AzContainerAppRevision, Enable-AzContainerAppRevision, Get-AzContainerApp, Get-AzContainerAppAuthConfig...}                                                              
Script     1.3.0      Az.AppConfiguration                 {Clear-AzAppConfigurationDeletedStore, Get-AzAppConfigurationDeletedStore, Get-AzAppConfigurationKey, Get-AzAppConfigurationKeyValue...}                                          
Script     2.2.3      Az.ApplicationInsights              {Get-AzApplicationInsights, Get-AzApplicationInsightsApiKey, Get-AzApplicationInsightsContinuousExport, Get-AzApplicationInsightsLinkedStorageAccount...}                         
Script     1.0.0      Az.ArcResourceBridge                {Get-AzArcResourceBridge, Get-AzArcResourceBridgeApplianceCredential, Get-AzArcResourceBridgeCredential, Get-AzArcResourceBridgeTelemetryConfig...}                               
Script     2.0.0      Az.Attestation                      {Add-AzAttestationPolicySigner, Get-AzAttestationPolicy, Get-AzAttestationPolicySigners, Remove-AzAttestationPolicySigner...}                                                     
Script     1.0.0      Az.Automanage                       {Get-AzAutomanageBestPractice, Get-AzAutomanageConfigProfile, Get-AzAutomanageConfigProfileAssignment, Get-AzAutomanageConfigProfileHciAssignment...}                             
Script     1.10.0     Az.Automation                       {Export-AzAutomationDscConfiguration, Export-AzAutomationDscNodeReportContent, Export-AzAutomationRunbook, Get-AzAutomationAccount...}                                            
Script     3.5.0      Az.Batch                            {Disable-AzBatchAutoScale, Disable-AzBatchComputeNodeScheduling, Disable-AzBatchJob, Disable-AzBatchJobSchedule...}                                                               
Script     2.0.3      Az.Billing                          {Get-AzBillingAccount, Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzBillingProfile...}                                                                                        
Script     3.1.1      Az.Cdn                              {Clear-AzCdnEndpointContent, Clear-AzFrontDoorCdnEndpointContent, Disable-AzCdnCustomDomainCustomHttps, Enable-AzCdnCustomDomainCustomHttps...}                                   
Script     2.0.0      Az.CloudService                     {Get-AzCloudService, Get-AzCloudServiceInstanceView, Get-AzCloudServiceNetworkInterface, Get-AzCloudServiceOSFamily...}                                                           
Script     1.14.1     Az.CognitiveServices                {Add-AzCognitiveServicesAccountNetworkRule, Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountCommitmentPlan, Get-AzCognitiveServicesAccountDeployment...}            
Script     7.1.1      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     4.0.0      Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability...}                                                   
Script     4.1.3      Az.ContainerRegistry                {Connect-AzContainerRegistry, Get-AzContainerRegistryManifest, Get-AzContainerRegistryRepository, Get-AzContainerRegistryTag...}                                                  
Script     1.14.0     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.7.1      Az.Databricks                       {Get-AzDatabricksAccessConnector, Get-AzDatabricksOutboundNetworkDependenciesEndpoint, Get-AzDatabricksVNetPeering, Get-AzDatabricksWorkspace...}                                 
Script     1.18.0     Az.DataFactory                      {Add-AzDataFactoryV2DataFlowDebugSessionPackage, Add-AzDataFactoryV2TriggerSubscription, Get-AzDataFactory, Get-AzDataFactoryActivityWindow...}                                   
Script     1.0.3      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     2.2.0      Az.DataProtection                   {Backup-AzDataProtectionBackupInstanceAdhoc, Edit-AzDataProtectionPolicyRetentionRuleClientObject, Edit-AzDataProtectionPolicyTagClientObject, Edit-AzDataProtectionPolicyTrigg...
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     4.3.0      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-AzWvdApplication, Get-AzWvdApplicationGroup...}                                                                          
Script     1.1.0      Az.DevCenter                        {Deploy-AzDevCenterUserEnvironment, Get-AzDevCenterAdminAttachedNetwork, Get-AzDevCenterAdminCatalog, Get-AzDevCenterAdminCatalogSyncErrorDetail...}                              
Script     1.0.2      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlVMsPerLabPolicy...}                                                               
Script     1.2.0      Az.Dns                              {Add-AzDnsRecordConfig, Get-AzDnsRecordSet, Get-AzDnsZone, New-AzDnsRecordConfig...}                                                                                              
Script     1.6.0      Az.EventGrid                        {Enable-AzEventGridPartnerTopic, Get-AzEventGridChannel, Get-AzEventGridDomain, Get-AzEventGridDomainKey...}                                                                      
Script     4.2.0      Az.EventHub                         {New-AzEventHubAuthorizationRuleSASToken, Approve-AzEventHubPrivateEndpointConnection, Deny-AzEventHubPrivateEndpointConnection, Get-AzEventHub...}                               
Script     1.10.0     Az.FrontDoor                        {Disable-AzFrontDoorCustomDomainHttps, Enable-AzFrontDoorCustomDomainHttps, Get-AzFrontDoor, Get-AzFrontDoorFrontendEndpoint...}                                                  
Script     4.0.7      Az.Functions                        {Get-AzFunctionApp, Get-AzFunctionAppAvailableLocation, Get-AzFunctionAppPlan, Get-AzFunctionAppSetting...}                                                                       
Script     6.1.0      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.5      Az.IotHub                           {Add-AzIotHubCertificate, Add-AzIotHubConfiguration, Add-AzIotHubDeployment, Add-AzIotHubDevice...}                                                                               
Script     5.1.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Add-AzKeyVaultCertificateContact, Add-AzKeyVaultKey, Add-AzKeyVaultManagedStorageAccount...}                                                          
Script     2.3.0      Az.Kusto                            {Add-AzKustoClusterLanguageExtension, Add-AzKustoDatabasePrincipal, Get-AzKustoAttachedDatabaseConfiguration, Get-AzKustoCluster...}                                              
Script     1.0.0      Az.LoadTesting                      {Get-AzLoad, New-AzLoad, Remove-AzLoad, Update-AzLoad}                                                                                                                            
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.0.0      Az.MachineLearningServices          {Get-AzMLServiceQuota, Get-AzMLServiceUsage, Get-AzMLServiceVMSize, Get-AzMLWorkspace...}                                                                                         
Script     1.4.1      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenancePublicConfiguration...}                                                       
Script     1.2.0      Az.ManagedServiceIdentity           {Get-AzFederatedIdentityCredential, 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.2      Az.Media                            {Get-AzMediaService, Get-AzMediaServiceKey, Get-AzMediaServiceNameAvailability, New-AzMediaService...}                                                                            
Script     2.2.0      Az.Migrate                          {Get-AzMigrateDiscoveredServer, Get-AzMigrateJob, Get-AzMigrateProject, Get-AzMigrateReplicationFabric...}                                                                        
Script     5.0.0      Az.Monitor                          {Add-AzLogProfile, Add-AzMetricAlertRule, Add-AzMetricAlertRuleV2, Add-AzWebtestAlertRule...}                                                                                     
Script     1.1.1      Az.MySql                            {Get-AzMySqlConfiguration, Get-AzMySqlConnectionString, Get-AzMySqlFirewallRule, Get-AzMySqlFlexibleServer...}                                                                    
Script     7.3.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayBackendSett...
Script     1.0.0      Az.NetworkCloud                     {Deploy-AzNetworkCloudCluster, Disable-AzNetworkCloudStorageApplianceRemoteVendorManagement, Enable-AzNetworkCloudStorageApplianceRemoteVendorManagement, Get-AzNetworkCloudAge...
Script     1.1.2      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get-AzNotificationHubPNSCredential...}                                              
Script     3.2.0      Az.OperationalInsights              {Disable-AzOperationalInsightsIISLogCollection, Disable-AzOperationalInsightsLinuxCustomLogCollection, Disable-AzOperationalInsightsLinuxPerformanceCollection, Disable-AzOpera...
Script     1.6.4      Az.PolicyInsights                   {Get-AzPolicyAttestation, Get-AzPolicyEvent, Get-AzPolicyMetadata, Get-AzPolicyRemediation...}                                                                                    
Script     1.1.0      Az.PostgreSql                       {Get-AzPostgreSqlConfiguration, Get-AzPostgreSqlConnectionString, Get-AzPostgreSqlFirewallRule, Get-AzPostgreSqlFlexibleServer...}                                                
Script     2.0.0      Az.PowerBIEmbedded                  {Get-AzPowerBIEmbeddedCapacity, New-AzPowerBIEmbeddedCapacity, Remove-AzPowerBIEmbeddedCapacity, Resume-AzPowerBIEmbeddedCapacity...}                                             
Script     1.0.4      Az.PrivateDns                       {Add-AzPrivateDnsRecordConfig, Get-AzPrivateDnsRecordSet, Get-AzPrivateDnsVirtualNetworkLink, Get-AzPrivateDnsZone...}                                                            
Script     6.7.0      Az.RecoveryServices                 {Add-AzRecoveryServicesAsrReplicationProtectedItemDisk, Backup-AzRecoveryServicesBackupItem, Copy-AzRecoveryServicesVault, Disable-AzRecoveryServicesBackupAutoProtection...}     
Script     1.8.1      Az.RedisCache                       {Export-AzRedisCache, Get-AzRedisCache, Get-AzRedisCacheFirewallRule, Get-AzRedisCacheKey...}                                                                                     
Script     1.2.0      Az.RedisEnterpriseCache             {Export-AzRedisEnterpriseCache, Get-AzRedisEnterpriseCache, Get-AzRedisEnterpriseCacheDatabase, Get-AzRedisEnterpriseCacheKey...}                                                 
Script     2.0.0      Az.Relay                            {Get-AzRelayAuthorizationRule, Get-AzRelayHybridConnection, Get-AzRelayKey, Get-AzRelayNamespace...}                                                                              
Script     1.2.0      Az.ResourceMover                    {Add-AzResourceMoverMoveResource, Get-AzResourceMoverMoveCollection, Get-AzResourceMoverMoveResource, Get-AzResourceMoverRequiredForResources...}                                 
Script     6.13.0     Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}                                                                                        
Script     1.5.1      Az.Security                         {Add-AzSecurityAdaptiveNetworkHardening, Add-AzSecuritySqlVulnerabilityAssessmentBaseline, Confirm-AzSecurityAutomation, Disable-AzIotSecurityAnalyticsAggregatedAlert...}        
Script     3.1.1      Az.SecurityInsights                 {Get-AzSentinelAlertRule, Get-AzSentinelAlertRuleAction, Get-AzSentinelAlertRuleTemplate, Get-AzSentinelAutomationRule...}                                                        
Script     3.0.0      Az.ServiceBus                       {New-AzServiceBusAuthorizationRuleSASToken, Test-AzServiceBusNameAvailability, Approve-AzServiceBusPrivateEndpointConnection, Complete-AzServiceBusMigration...}                  
Script     3.3.2      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricManagedClusterClientCertificate, Add-AzServiceFabricManagedClusterNetworkSecurityRule, Add-AzServiceFabricManagedNode...
Script     2.0.0      Az.SignalR                          {Get-AzSignalR, Get-AzSignalRKey, Get-AzSignalRUsage, New-AzSignalR...}                                                                                                           
Script     4.13.0     Az.Sql                              {Add-AzSqlDatabaseToFailoverGroup, Add-AzSqlElasticJobStep, Add-AzSqlElasticJobTarget, Add-AzSqlInstanceKeyVaultKey...}                                                           
Script     2.1.0      Az.SqlVirtualMachine                {Get-AzAvailabilityGroupListener, Get-AzSqlVM, Get-AzSqlVMGroup, Invoke-AzRedeploySqlVM...}                                                                                       
Script     2.2.3      Az.StackHCI                         {Add-AzStackHCIVMAttestation, Disable-AzStackHCIAttestation, Disable-AzStackHCIRemoteSupport, Enable-AzStackHCIAttestation...}                                                    
Script     6.1.0      Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle...}                                    
Script     1.3.0      Az.StorageMover                     {Get-AzStorageMover, Get-AzStorageMoverAgent, Get-AzStorageMoverEndpoint, Get-AzStorageMoverJobDefinition...}                                                                     
Script     2.1.1      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     3.0.5      Az.Synapse                          {Add-AzSynapseDataFlowDebugSessionPackage, Add-AzSynapseTriggerSubscription, Clear-AzSynapseSqlPoolVulnerabilityAssessmentRuleBaseline, Convert-AzSynapseSqlPoolVulnerabilityAs...
Script     1.2.2      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Add-AzTrafficManagerCustomHeaderToProfile, Add-AzTrafficManagerEndpointConfig, Add-AzTrafficManagerExpectedStatusCodeRange...}       
Script     3.1.2      Az.Websites                         {Add-AzWebAppAccessRestrictionRule, Add-AzWebAppTrafficRouting, Edit-AzWebAppBackupConfiguration, Get-AzAppServiceEnvironment...}

Error output

HistoryId: -1

Message        : There is no active Azure PowerShell session. Please run 'Connect-AzAccount'
StackTrace     : 
Exception      : System.InvalidOperationException
InvocationInfo : {}
Line           :     throw $errorRecord

Position       : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.7\custom\HelperFunctions.ps1:869 char:5
                 +     throw $errorRecord
                 +     ~~~~~~~~~~~~~~~~~~
HistoryId      : -1

Message        : There is no active Azure PowerShell session. Please run 'Connect-AzAccount'
StackTrace     : 
Exception      : System.InvalidOperationException
InvocationInfo : {}
Line           :     throw $errorRecord

Position       : At C:\Program Files\WindowsPowerShell\Modules\Az.Functions\4.0.7\custom\HelperFunctions.ps1:869 char:5
                 +     throw $errorRecord
                 +     ~~~~~~~~~~~~~~~~~~
HistoryId      : -1

   HistoryId: 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

Message        : Cannot find a variable with the name 'DEBUG_PREFIX'.
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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.7\custom\HelperFunctions.ps1:46 char:15
                 + ...   if (-not (Get-Variable $variableName -ErrorAction SilentlyContinue) ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

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.RuntimeModule.GetTypes()
                    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\7.1.1\Az.Compute.psm1:39 char:21
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

   HistoryId: -1

Message        : Unable to find type [Microsoft.PowerShell.Commands.PowerShellGet.Telemetry].
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)
Exception      : System.Management.Automation.RuntimeException
InvocationInfo : {}
Line           :     $telemetryMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | Get-Member -Static).Name

Position       : At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:715 char:26
                 + ... yMethods = ([Microsoft.PowerShell.Commands.PowerShellGet.Telemetry] | ...
                 +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : -1
isra-fel commented 9 months ago

Hey @init5-SF sorry about that. This is a known issue to https://github.com/Azure/azure-powershell/issues/23788

Currently the work-arounds are:

  1. Run Connect-AzAccount to sign in before Import-Module Az, or
  2. Do not explictly Import-Module Az at all. (Only works if your script doesn't depend on Az.Functions module)
init5-SF commented 9 months ago

Hi @isra-fel thanks for the info. Is there any planned fix?

isra-fel commented 9 months ago

Currently the plan is to fix in Az 11.4.0. Please track in #23788