Product: PowerShell Universal
Version: 3.9.12
Deployment: Azure Web App
I’ve been banging my head to this issue I’m facing with trying to use CosmosDB PSModule within a Universal environment.
As soon as I try to create a new CosmosDB Context, I’m faced with the following warning:
Both Az and AzureRM modules were detected on this machine.
Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook.
If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine.
If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide
Upon further investigation, when I create a new Terminal for any of the Enviromnents (default and custom created ones) and run Get-Module -ListAvailable I find the following:
Directory: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.1.0 AzureRM.ApiManagement {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementSs...
Manifest 1.0.8 AzureRM.Automation {Get-AzureRmAutomationJobOutputRecord, Import-AzureRmAutoma...
Binary 0.9.5 AzureRM.AzureStackAdmin {Get-AzureRMManagedLocation, New-AzureRMManagedLocation, Re...
Manifest 0.9.6 AzureRM.AzureStackStorage {Add-ACSFarm, Get-ACSEvent, Get-ACSEventQuery, Get-ACSFarm...}
Manifest 1.0.8 AzureRM.Backup {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerRer...
Manifest 1.1.0 AzureRM.Batch {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-A...
Manifest 1.0.2 AzureRM.Cdn {Get-AzureRmCdnCustomDomain, New-AzureRmCdnCustomDomain, Re...
Manifest 1.3.0 AzureRM.Compute {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet,...
Manifest 1.0.8 AzureRM.DataFactories {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get-...
Manifest 1.1.0 AzureRM.DataLakeAnalytics {Get-AzureRmDataLakeAnalyticsDataSource, Remove-AzureRmData...
Manifest 1.0.8 AzureRM.DataLakeStore {Add-AzureRmDataLakeStoreItemContent, Export-AzureRmDataLak...
Manifest 1.0.8 AzureRM.Dns {Get-AzureRmDnsRecordSet, Remove-AzureRmDnsRecordSet, Set-A...
Manifest 1.1.0 AzureRM.HDInsight {Get-AzureRmHDInsightJob, New-AzureRmHDInsightSqoopJobDefin...
Manifest 1.0.8 AzureRM.Insights {Add-AzureRmMetricAlertRule, Add-AzureRmLogAlertRule, Add-A...
Manifest 1.1.7 AzureRM.KeyVault {Get-AzureRmKeyVault, New-AzureRmKeyVault, Remove-AzureRmKe...
Manifest 1.0.4 AzureRM.LogicApp {Stop-AzureRmLogicAppRun, Get-AzureRmLogicApp, Get-AzureRmL...
Manifest 1.0.9 AzureRM.Network {Add-AzureRmApplicationGatewayBackendAddressPool, Get-Azure...
Manifest 1.0.8 AzureRM.NotificationHubs {Get-AzureRmNotificationHubsNamespaceAuthorizationRules, Ge...
Manifest 1.0.8 AzureRM.OperationalInsights {Get-AzureRmOperationalInsightsSavedSearch, Get-AzureRmOper...
Manifest 1.0.8 AzureRM.Profile {Enable-AzureRmDataCollection, Disable-AzureRmDataCollectio...
Manifest 1.1.0 AzureRM.RecoveryServices {Get-AzureRmRecoveryServicesBackupProperties, Get-AzureRmRe...
Manifest 1.0.0 AzureRM.RecoveryServices.Backup {Backup-AzureRmRecoveryServicesBackupItem, Get-AzureRmRecov...
Manifest 1.1.6 AzureRM.RedisCache {Remove-AzureRmRedisCacheDiagnostics, Set-AzureRmRedisCache...
Manifest 1.1.0 AzureRM.Resources {Get-AzureRmADApplication, Get-AzureRmADGroupMember, Get-Az...
Manifest 1.1.7 AzureRM.SiteRecovery {Stop-AzureRmSiteRecoveryJob, Get-AzureRmSiteRecoveryNetwor...
Manifest 1.0.8 AzureRM.Sql {Get-AzureRmSqlDatabaseImportExportStatus, New-AzureRmSqlDa...
Manifest 1.1.0 AzureRM.Storage {Get-AzureRmStorageAccount, Get-AzureRmStorageAccountKey, G...
Manifest 1.0.8 AzureRM.StreamAnalytics {Get-AzureRmStreamAnalyticsFunction, Get-AzureRmStreamAnaly...
Manifest 1.0.8 AzureRM.Tags {Remove-AzureRmTag, Get-AzureRmTag, New-AzureRmTag}
Manifest 1.0.8 AzureRM.TrafficManager {Disable-AzureRmTrafficManagerEndpoint, Enable-AzureRmTraff...
Manifest 1.0.8 AzureRM.UsageAggregates Get-UsageAggregates
Manifest 1.1.0 AzureRM.Websites {Get-AzureRmAppServicePlanMetrics, New-AzureRmWebAppDatabas...
I have no idea why these are installed and am at a loss as to how to get rid of them, or if I’m even able to get rid of them without facing issues afterwards…
Not really a Universal issue, but I was hoping someone could help me out with this.