Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.21k stars 3.81k forks source link

Inconsistent - Connect-AzAccount : Entry point was not found error #23927

Open IsraelOrosMsft opened 8 months ago

IsraelOrosMsft commented 8 months ago

Description

I am having issues identifying the root cause of the Connect-AzAccount : Entry point was not found error in my system. The behavior of the Connect-AzAccount cmdlet is completely inconsistent. For example, I can open a Windows PowerShell ISE window and run the cmdlet and it runs perfectly. But if I open a new Windows PowerShell ISE window, the cmdlet will fail with the Entry point was not found error. Same script, just run in two different instances of the PowerShell ISE process. I can even run the exact same script simultaneously on both sessions and one of them will fail and the other succeed.

AzAccounts-Error

Issue script & Debug output

PS C:\Users\ioros> C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1
01/10/2024 13:55:22
DEBUG: Called Initialization method
DEBUG: Starting extension SQLRegistration
DEBUG: Starting extension SQLSERVER
DEBUG: Starting extension SQL
DEBUG: Starting extension XEvent
DEBUG: Starting extension DatabaseXEvent
DEBUG: Starting extension DataCollection
DEBUG: Starting extension SQLPolicy
DEBUG: Starting extension SQLAS
DEBUG: ItemExists: SQLSERVER:\
DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.20348.2227].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\2.13.2\StartupScripts\..\lib].
######################### TESTING: Az 11.0.0 and Az.Accounts 2.13.2 ######################################

**** Display versions of modules loaded in memory ****

ModuleType Version    Name                                ExportedCommands                                                                                                                                                                             
---------- -------    ----                                ----------------                                                                                                                                                                             
Script     2.13.2     Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault...}                                                                                                                     
Script     22.1.1     SQLServer                           {Add-RoleMember, Add-SqlAvailabilityDatabase, Add-SqlAvailabilityGroupListenerStaticIp, Add-SqlAzureAuthenticationContext...}                                                                
Script     11.0.0     Az                                                                                                                                                                                                                               

**** Setting environment variables ****

**** Configuration variables ****

tenantId = xxxxxxxxx
SubscriptionID = xxxxxxxxxx
UserName = xxxxxxxxxxxxx
SerializedPassword = xxxxxxxxx

**** Connecting as service principal ****
This is the step that has generated the issue in WTW's environment
DEBUG: 1:55:36 PM - ConnectAzureRmAccountCommand begin processing with ParameterSet 'ServicePrincipalWithSubscriptionId'.
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - Autosave setting from startup session: 'CurrentUser'
DEBUG: 1:55:36 PM - No autosave setting detected in environment variable 'AzContextAutoSave'. 
DEBUG: 1:55:36 PM - Using Autosave scope 'CurrentUser'
DEBUG: 1:55:36 PM - Autosave setting from startup session: 'CurrentUser'
DEBUG: 1:55:36 PM - No autosave setting detected in environment variable 'AzContextAutoSave'. 
DEBUG: 1:55:36 PM - Using Autosave scope 'CurrentUser'
DEBUG: 1:55:36 PM - [ServicePrincipalAuthenticator] Calling ClientSecretCredential.GetTokenAsync - ApplicationId:'xxxxxxxxxx', TenantId:'yyyyyyyy', 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 2022 Datacenter [2024-01-10 13:55:36Z - 53485ce5-16a6-4f5b-af47-4a781955dc4e] MSAL MSAL.Desktop with assembly version '4.46.0.0'. CorrelationId(53485ce5-16a6-4f5b-af47-4a781955dc4e
)
DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2024-01-10 13:55:36Z - 53485ce5-16a6-4f5b-af47-4a781955dc4e] === AcquireTokenForClientParameters ===
SendX5C: False
ForceRefresh: False

DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2024-01-10 13:55:36Z - 53485ce5-16a6-4f5b-af47-4a781955dc4e] 
=== 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 - 53485ce5-16a6-4f5b-af47-4a781955dc4e
UserAssertion set: False
LongRunningOboCacheKey set: False
Region configured: 

DEBUG: False MSAL 4.46.0.0 MSAL.Desktop 4.8 or later Windows Server 2022 Datacenter [2024-01-10 13:55:36Z - 53485ce5-16a6-4f5b-af47-4a781955dc4e] === 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 2022 Datacenter [2024-01-10 13:55:36Z - 53485ce5-16a6-4f5b-af47-4a781955dc4e] [Region discovery] Not using a regional authority. 
DEBUG: Request [59038347-23d4-4e11-9703-690b451c1a3e] POST https://login.microsoftonline.com/31700f5e-6a20-4d25-989b-848193536b90/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:59038347-23d4-4e11-9703-690b451c1a3e
x-ms-return-client-request-id:true
User-Agent:azsdk-net-Identity/1.6.1 (.NET Framework 4.8.4645.0; Microsoft Windows 10.0.20348 )
client assembly: Azure.Identity
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisableErrorRecordsPersistence], Module = [], Cmdlet = []. Returning default value [False].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
Connect-AzAccount : Entry point was not found.
Could not find tenant id for provided tenant domain 'xxxxxxxx'. Please ensure that the provided service principal 'yyyyyyyyyyy' is found in the provided tenant domain.
At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:62 char:1
+ Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Connect-AzAccount], ArgumentNullException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand

DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.2; CommandName: Connect-AzAccount; PSVersion: 5.1.20348.2227; IsSuccess: False; Duration: 00:00:00.1233882; Exception: Entry point was not found.
Could not find tenant id for provided tenant domain 'xxxxxxx'. Please ensure that the provided service principal 'yyyyyyyy' is found in the provided tenant domain.;
DEBUG: 1:55:36 PM - ConnectAzureRmAccountCommand end processing.

**** Displaying Context ****
DEBUG: 1:55:36 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.2; CommandName: Get-AzContext; PSVersion: 5.1.20348.2227; IsSuccess: True; Duration: 00:00:00.0047867
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - GetAzureRMContextCommand end processing.

**** Disconnecting from Azure account ****
DEBUG: 1:55:36 PM - DisconnectAzureRmAccountCommand begin processing with ParameterSet 'ContextName'.
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.2; CommandName: Disconnect-AzAccount; PSVersion: 5.1.20348.2227; IsSuccess: True; Duration: 00:00:00.0048556
DEBUG: 1:55:36 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:36 PM - DisconnectAzureRmAccountCommand end processing.

**** Displaying Context after disconnection (nothing should be displayed) ****
DEBUG: 1:55:37 PM - GetAzureRMContextCommand begin processing with ParameterSet 'GetSingleContext'.
DEBUG: 1:55:37 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:37 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:37 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.2; CommandName: Get-AzContext; PSVersion: 5.1.20348.2227; IsSuccess: True; Duration: 00:00:00.0041825
DEBUG: 1:55:37 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:55:37 PM - GetAzureRMContextCommand end processing.

**** Removing powershell modules from current session ****

**** End of script ****

Environment data

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

Module versions

ModuleType Version    Name                                ExportedCommands                                                                                                                                                                             
---------- -------    ----                                ----------------                                                                                                                                                                             
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.2      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.9.1      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.0.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     4.0.0      Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability...}                                                              
Script     4.1.2      Az.ContainerRegistry                {Connect-AzContainerRegistry, Get-AzContainerRegistryManifest, Get-AzContainerRegistryRepository, Get-AzContainerRegistryTag...}                                                             
Script     1.13.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.17.1     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.1.0      Az.DataProtection                   {Backup-AzDataProtectionBackupInstanceAdhoc, Edit-AzDataProtectionPolicyRetentionRuleClientObject, Edit-AzDataProtectionPolicyTagClientObject, Edit-AzDataProtectionPolicyTriggerClientObj...
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.2.0      Az.DesktopVirtualization            {Disconnect-AzWvdUserSession, Expand-AzWvdMsixImage, Get-AzWvdAppAttachPackage, Get-AzWvdApplication...}                                                                                     
Script     1.0.0      Az.DevCenter                        {Deploy-AzDevCenterUserEnvironment, Get-AzDevCenterAdminAttachedNetwork, Get-AzDevCenterAdminCatalog, Get-AzDevCenterAdminDevBoxDefinition...}                                               
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.0.2      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.0.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.0      Az.Maintenance                      {Get-AzApplyUpdate, Get-AzConfigurationAssignment, Get-AzMaintenanceConfiguration, Get-AzMaintenancePublicConfiguration...}                                                                  
Script     1.1.1      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.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.0.0      Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzApplicationGatewayBackendAddressPool, Add-AzApplicationGatewayBackendHttpSetting, Add-AzApplicationGatewayBackendSetting...}       
Script     1.0.0      Az.NetworkCloud                     {Deploy-AzNetworkCloudCluster, Disable-AzNetworkCloudStorageApplianceRemoteVendorManagement, Enable-AzNetworkCloudStorageApplianceRemoteVendorManagement, Get-AzNetworkCloudAgentPool...}    
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-AzOperationalInsig...
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.6.1      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.12.0     Az.Resources                        {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAssignment, Get-AzDeployment...}                                                                                                   
Script     1.5.0      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.0      Az.ServiceFabric                    {Add-AzServiceFabricClientCertificate, Add-AzServiceFabricManagedClusterClientCertificate, Add-AzServiceFabricManagedClusterNetworkSecurityRule, Add-AzServiceFabricManagedNodeTypeVMExten...
Script     2.0.0      Az.SignalR                          {Get-AzSignalR, Get-AzSignalRKey, Get-AzSignalRUsage, New-AzSignalR...}                                                                                                                      
Script     4.11.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.0.0      Az.Storage                          {Add-AzRmStorageContainerLegalHold, Add-AzStorageAccountManagementPolicyAction, Add-AzStorageAccountNetworkRule, Close-AzStorageFileHandle...}                                               
Script     1.2.0      Az.StorageMover                     {Get-AzStorageMover, Get-AzStorageMoverAgent, Get-AzStorageMoverEndpoint, Get-AzStorageMoverJobDefinition...}                                                                                
Script     2.1.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     3.0.4      Az.Synapse                          {Add-AzSynapseDataFlowDebugSessionPackage, Add-AzSynapseTriggerSubscription, Clear-AzSynapseSqlPoolVulnerabilityAssessmentRuleBaseline, Convert-AzSynapseSqlPoolVulnerabilityAssessmentSca...
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

DEBUG: Initializing ConditionalAssemblyContext. PSEdition is [Desktop]. PSVersion is [5.1.20348.2227].
DEBUG: Initializing ConditionalAssemblyProvider. AssemblyRootPath is [C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\2.13.2\StartupScripts\..\lib].
DEBUG: 1:59:50 PM - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
DEBUG: 1:59:50 PM - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].

   HistoryId: 7

Message        : Entry point was not found.
                 Could not find tenant id for provided tenant domain 'XXXXXXXX'. Please ensure that the provided service principal 'YYYYYYYYY' is found in the provided tenant domain.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_2.<ExecuteCmdlet>b__5()
                    at System.Threading.Tasks.Task`1.InnerInvoke()
                    at System.Threading.Tasks.Task.Execute()
                 --- 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.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_1.<ExecuteCmdlet>b__1(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
                    at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentNullException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:62 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7

Message        : Entry point was not found.
StackTrace     :    at System.Threading.Tasks.Sources.IValueTaskSource`1.GetStatus(Int16 token)
                    at Microsoft.Azure.PowerShell.Authenticators.MsalAccessToken.<GetAccessTokenAsync>d__33.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, String promptBehavior, Action`1 
                 promptAction, IAzureTokenCache tokenCache, String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String promptBehavior, Action`1 promptAction, 
                 String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
Exception      : System.EntryPointNotFoundException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:62 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 7

   HistoryId: 6

Message        : The term 'runTime' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
StackTrace     :    at System.Management.Automation.CommandDiscovery.LookupCommandInfo(String commandName, CommandTypes commandTypes, SearchResolutionOptions searchResolutionOptions, CommandOrigin commandOrigin, ExecutionContext context)
                    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.CommandNotFoundException
InvocationInfo : {}
Line           : runTime = date

Position       : At line:1 char:1
                 + runTime = date
                 + ~~~~~~~
HistoryId      : 6

   HistoryId: 5

Message        : Entry point was not found.
                 Could not find tenant id for provided tenant domain 'XXXXXXXXXXXXXX'. Please ensure that the provided service principal 'YYYYYYYYYYYYY' is found in the provided tenant domain.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_2.<ExecuteCmdlet>b__5()
                    at System.Threading.Tasks.Task`1.InnerInvoke()
                    at System.Threading.Tasks.Task.Execute()
                 --- 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.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_1.<ExecuteCmdlet>b__1(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
                    at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentNullException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID -Debug

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:60 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

Message        : Entry point was not found.
StackTrace     :    at System.Threading.Tasks.Sources.IValueTaskSource`1.GetStatus(Int16 token)
                    at Microsoft.Azure.PowerShell.Authenticators.MsalAccessToken.<GetAccessTokenAsync>d__33.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, String promptBehavior, Action`1 
                 promptAction, IAzureTokenCache tokenCache, String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String promptBehavior, Action`1 promptAction, 
                 String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
Exception      : System.EntryPointNotFoundException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID -Debug

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:60 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 5

   HistoryId: 2

Message        : Entry point was not found.
                 Could not find tenant id for provided tenant domain 'XXXXXXXXXXXX'. Please ensure that the provided service principal 'YYYYYYYYYYYYY' is found in the provided tenant domain.
StackTrace     :    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_2.<ExecuteCmdlet>b__5()
                    at System.Threading.Tasks.Task`1.InnerInvoke()
                    at System.Threading.Tasks.Task.Execute()
                 --- 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.Profile.ConnectAzureRmAccountCommand.<>c__DisplayClass127_1.<ExecuteCmdlet>b__1(AzureRmProfile localProfile, RMProfileClient profileClient, String name)
                    at Microsoft.Azure.Commands.Profile.Common.AzureContextModificationCmdlet.ModifyContext(Action`2 contextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.SetContextWithOverwritePrompt(Action`3 setContextAction)
                    at Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand.ExecuteCmdlet()
                    at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
Exception      : System.ArgumentNullException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:60 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2

Message        : Entry point was not found.
StackTrace     :    at System.Threading.Tasks.Sources.IValueTaskSource`1.GetStatus(Int16 token)
                    at Microsoft.Azure.PowerShell.Authenticators.MsalAccessToken.<GetAccessTokenAsync>d__33.MoveNext()
                 --- End of stack trace from previous location where exception was thrown ---
                    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                    at Microsoft.Azure.Commands.Common.Authentication.Factories.AuthenticationFactory.Authenticate(IAzureAccount account, IAzureEnvironment environment, String tenant, SecureString password, String promptBehavior, Action`1 
                 promptAction, IAzureTokenCache tokenCache, String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.AcquireAccessToken(IAzureAccount account, IAzureEnvironment environment, String tenantId, SecureString password, String promptBehavior, Action`1 promptAction, 
                 String resourceId)
                    at Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient.Login(IAzureAccount account, IAzureEnvironment environment, String tenantIdOrName, String subscriptionId, String subscriptionName, SecureString password, 
                 Boolean skipValidation, IOpenIDConfiguration openIDConfigDoc, Action`1 promptAction, String name, Boolean shouldPopulateContextList, Int32 maxContextPopulation, String authScope)
Exception      : System.EntryPointNotFoundException
InvocationInfo : {Connect-AzAccount}
Line           : Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Tenant $tenantId -SubscriptionId $SubscriptionID

Position       : At C:\Users\ioros\Downloads\mslearn-azure-sql-fundamentals-master\05-Availability\testBatch.ps1:60 char:1
                 + Connect-AzAccount -ServicePrincipal -Credential $ProdCredentials -Ten ...
                 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2

   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: 2

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      : 2

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      : 2

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      : 2

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      : 2

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      : 2

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      : 2

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      : 2

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      : 2

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\7.0.0\Az.Compute.psm1:39 char:21
                 + ...                Add-Type -Path $_.FullName -ErrorAction Ignore | Out-N ...
                 +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId      : 2

DEBUG: 1:59:51 PM - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:59:51 PM - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: AzureQoSEvent:  Module: Az.Accounts:2.13.2; CommandName: Resolve-AzError; PSVersion: 5.1.20348.2227; IsSuccess: True; Duration: 00:00:00.8192613
DEBUG: 1:59:51 PM - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
DEBUG: 1:59:51 PM - ResolveError end processing.
isra-fel commented 7 months ago

According to Israel's findings and our investigation, this is a conflict of the Azure.Core assembly that both SqlServer and Az.Accounts depend on. Both products handles the AssemblyResolve event to redirect the assembly binding. Whichever module gets loaded first has the higher priority for the binding and would shadow the other one.

isra-fel commented 7 months ago

There hasn't been a perfect solution to this problem on Windows PowerShell, but on PowerShell 7, the Azure.Core assembly is loaded in a custom AssemblyLoadContext and hence isolated from other modules, so this issue won't happen.

ITJoeSchmo commented 7 months ago

If this is an assembly conflict, this workaround solution may work but would need to be adjusted for the particular conflicting assembly and versions. There is instruction on seeing that listed: https://github.com/Azure/azure-powershell/issues/21960#issuecomment-1938831513

If it's newtonsoft.json which is very commonly the conflicting assembly, you can redirect it to use new versions with an app.config per my post linked above.