Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-AzureBatchPool fails by saying "Could not load file or assembly 'Microsoft.Extensions.Primitives, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified." #9585

Closed
avi1479 opened this issue Jul 10, 2019 · 3 comments
Assignees
Labels
Batch Service Attention This issue is responsible by Azure service team.

Comments

@avi1479
Copy link

avi1479 commented Jul 10, 2019

Description

Get-AzureBatchPool fails by saying "Could not load file or assembly 'Microsoft.Extensions.Primitives, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified."

Steps that I followed to install Az cmdlets:

  1. Uninstalled the AzureRm modules on my machine completely.
  2. Installed the Az cmdlets (as explained in here)
  3. Enabled the AzureRm aliases (as explained in here).

This installation process installed the 1.1.0 Az.Batch module which contains 'Microsoft.Extensions.Primitives.dll' with version 1.1.0-rtm-22752.

Exception Details:

Get-AzureBatchPool : Could not load file or assembly 'Microsoft.Extensions.Primitives, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The 
system cannot find the file specified.
At line:1 char:20
+ $ExisingPoolIDs = (Get-AzureBatchPool -BatchContext $context).Id
    + CategoryInfo          : CloseError: (:) [Get-AzBatchPool], FileNotFoundException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Batch.GetBatchPoolCommand

Workarounds

1. Run the command: Install-Package 'Microsoft.Extensions.Primitives' -RequiredVersion 1.0.1.0.

  1. Go to C:\Program Files\WindowsPowerShell\Modules\Az.Batch\1.1.0 and delete the existing Microsoft.Extensions.Primitives.dll .

  2. Go to C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.Extensions.Primitives.1.0.1 and copy the DLL from there. And paste the DLL into C:\Program Files\WindowsPowerShell\Modules\Az.Batch\1.1.0.

Steps to Reproduce

$context = Get-AzureRmBatchAccountKeys -AccountName yourbatchaccountname -ResourceGroupName yourresourcegroup
$ExisingPoolIDs = (Get-AzureBatchPool -BatchContext $context).Id

Module Version

PS C:\WINDOWS\system32> Get-Module -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                    
---------- -------    ----                                ----------------                                                                                    
Script     1.0.6      ACME-PS                             {Find-ACMEAccount, Get-ACMEAccount, New-ACMEAccount, Set-ACMEAccount...}                            
Binary     0.9.1.326  ACMESharp                           {Get-ACMECertificate, Get-ACMEChallengeHandlerProfile, Get-ACMEIdentifier, Complete-ACMEChallenge...
Manifest   0.9.1.326  ACMESharp.Providers.IIS                                                                                                                 
Script     1.6.0      Az.Accounts                         {Disable-AzDataCollection, Disable-AzContextAutosave, Enable-AzDataCollection, Enable-AzContextAu...
Script     1.0.0      Az.Advisor                          {Get-AzAdvisorRecommendation, Enable-AzAdvisorRecommendation, Disable-AzAdvisorRecommendation, Ge...
Script     1.0.1      Az.Aks                              {Get-AzAks, New-AzAks, Remove-AzAks, Import-AzAksCredential...}                                     
Script     1.1.0      Az.AnalysisServices                 {Resume-AzAnalysisServicesServer, Suspend-AzAnalysisServicesServer, Get-AzAnalysisServicesServer,...
Script     1.2.0      Az.ApiManagement                    {Add-AzApiManagementApiToProduct, Add-AzApiManagementProductToGroup, Add-AzApiManagementRegion, A...
Script     1.0.0      Az.ApplicationInsights              {Get-AzApplicationInsights, New-AzApplicationInsights, Remove-AzApplicationInsights, Set-AzApplic...
Script     1.3.0      Az.Automation                       {Get-AzAutomationHybridWorkerGroup, Remove-AzAutomationHybridWorkerGroup, Get-AzAutomationJobOutp...
Script     1.1.0      Az.Batch                            {Remove-AzBatchAccount, Get-AzBatchAccount, Get-AzBatchAccountKey, New-AzBatchAccount...}           
Script     1.0.0      Az.Billing                          {Get-AzBillingInvoice, Get-AzBillingPeriod, Get-AzEnrollmentAccount, Get-AzConsumptionBudget...}    
Script     1.3.0      Az.Cdn                              {Get-AzCdnProfile, Get-AzCdnProfileSsoUrl, New-AzCdnProfile, Remove-AzCdnProfile...}                
Script     1.1.1      Az.CognitiveServices                {Get-AzCognitiveServicesAccount, Get-AzCognitiveServicesAccountKey, Get-AzCognitiveServicesAccoun...
Script     2.4.0      Az.Compute                          {Remove-AzAvailabilitySet, Get-AzAvailabilitySet, New-AzAvailabilitySet, Update-AzAvailabilitySet...
Script     1.0.1      Az.ContainerInstance                {New-AzContainerGroup, Get-AzContainerGroup, Remove-AzContainerGroup, Get-AzContainerInstanceLog}   
Script     1.0.1      Az.ContainerRegistry                {New-AzContainerRegistry, Get-AzContainerRegistry, Update-AzContainerRegistry, Remove-AzContainer...
Script     1.1.2      Az.DataFactory                      {Set-AzDataFactoryV2, Update-AzDataFactoryV2, Get-AzDataFactoryV2, Remove-AzDataFactoryV2...}       
Script     1.0.0      Az.DataLakeAnalytics                {Get-AzDataLakeAnalyticsDataSource, New-AzDataLakeAnalyticsCatalogCredential, Remove-AzDataLakeAn...
Script     1.2.1      Az.DataLakeStore                    {Get-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLakeStoreTrustedIdProvider, Remove-AzDataLake...
Script     1.0.0      Az.DeploymentManager                {Get-AzDeploymentManagerArtifactSource, New-AzDeploymentManagerArtifactSource, Set-AzDeploymentMa...
Script     1.0.0      Az.DevTestLabs                      {Get-AzDtlAllowedVMSizesPolicy, Get-AzDtlAutoShutdownPolicy, Get-AzDtlAutoStartPolicy, Get-AzDtlV...
Script     1.1.1      Az.Dns                              {Get-AzDnsRecordSet, New-AzDnsRecordConfig, Remove-AzDnsRecordSet, Set-AzDnsRecordSet...}           
Script     1.2.1      Az.EventGrid                        {New-AzEventGridTopic, Get-AzEventGridTopic, Set-AzEventGridTopic, New-AzEventGridTopicKey...}      
Script     1.2.0      Az.EventHub                         {New-AzEventHubNamespace, Get-AzEventHubNamespace, Set-AzEventHubNamespace, Remove-AzEventHubName...
Script     1.1.0      Az.FrontDoor                        {New-AzFrontDoor, Get-AzFrontDoor, Set-AzFrontDoor, Remove-AzFrontDoor...}                          
Script     2.0.0      Az.HDInsight                        {Get-AzHDInsightJob, New-AzHDInsightSqoopJobDefinition, Wait-AzHDInsightJob, New-AzHDInsightStrea...
Script     1.2.0      Az.IotHub                           {Add-AzIotHubKey, Get-AzIotHubEventHubConsumerGroup, Get-AzIotHubConnectionString, Get-AzIotHubJo...
Script     1.2.0      Az.KeyVault                         {Add-AzKeyVaultCertificate, Update-AzKeyVaultCertificate, Stop-AzKeyVaultCertificateOperation, Ge...
Script     1.2.1      Az.LogicApp                         {Get-AzIntegrationAccountAgreement, Get-AzIntegrationAccountAssembly, Get-AzIntegrationAccountBat...
Script     1.1.0      Az.MachineLearning                  {Move-AzMlCommitmentAssociation, Get-AzMlCommitmentAssociation, Get-AzMlCommitmentPlanUsageHistor...
Script     1.0.0      Az.MarketplaceOrdering              {Get-AzMarketplaceTerms, Set-AzMarketplaceTerms}                                                    
Script     1.1.0      Az.Media                            {Sync-AzMediaServiceStorageKey, Set-AzMediaServiceKey, Get-AzMediaServiceKey, Get-AzMediaServiceN...
Script     1.2.1      Az.Monitor                          {Get-AzMetricDefinition, Get-AzMetric, Remove-AzLogProfile, Get-AzLogProfile...}                    
Script     1.11.0     Az.Network                          {Add-AzApplicationGatewayAuthenticationCertificate, Get-AzApplicationGatewayAuthenticationCertifi...
Script     1.1.0      Az.NotificationHubs                 {Get-AzNotificationHub, Get-AzNotificationHubAuthorizationRule, Get-AzNotificationHubListKey, Get...
Script     1.3.1      Az.OperationalInsights              {New-AzOperationalInsightsAzureActivityLogDataSource, New-AzOperationalInsightsCustomLogDataSourc...
Script     1.1.2      Az.PolicyInsights                   {Get-AzPolicyEvent, Get-AzPolicyState, Get-AzPolicyStateSummary, Get-AzPolicyRemediation...}        
Script     1.1.0      Az.PowerBIEmbedded                  {Remove-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCollection, Get-AzPowerBIWorkspaceCol...
Script     1.4.2      Az.RecoveryServices                 {Get-AzRecoveryServicesBackupProperty, Get-AzRecoveryServicesVault, Get-AzRecoveryServicesVaultSe...
Script     1.1.0      Az.RedisCache                       {Remove-AzRedisCachePatchSchedule, New-AzRedisCacheScheduleEntry, Get-AzRedisCachePatchSchedule, ...
Script     1.0.1      Az.Relay                            {New-AzRelayNamespace, Get-AzRelayNamespace, Set-AzRelayNamespace, Remove-AzRelayNamespace...}      
Script     1.6.0      Az.Resources                        {Get-AzProviderOperation, Remove-AzRoleAssignment, Get-AzRoleAssignment, New-AzRoleAssignment...}   
Script     1.2.1      Az.ServiceBus                       {New-AzServiceBusNamespace, Get-AzServiceBusNamespace, Set-AzServiceBusNamespace, Remove-AzServic...
Script     1.1.1      Az.ServiceFabric                    {Add-AzServiceFabricApplicationCertificate, Add-AzServiceFabricClientCertificate, Add-AzServiceFa...
Script     1.0.2      Az.SignalR                          {New-AzSignalR, Get-AzSignalR, Get-AzSignalRKey, New-AzSignalRKey...}                               
Script     1.13.0     Az.Sql                              {Get-AzSqlDatabaseTransparentDataEncryption, Get-AzSqlDatabaseTransparentDataEncryptionActivity, ...
Script     1.5.0      Az.Storage                          {Get-AzStorageAccount, Get-AzStorageAccountKey, New-AzStorageAccount, New-AzStorageAccountKey...}   
Script     1.1.1      Az.StorageSync                      {Invoke-AzStorageSyncCompatibilityCheck, New-AzStorageSyncService, Get-AzStorageSyncService, Remo...
Script     1.0.0      Az.StreamAnalytics                  {Get-AzStreamAnalyticsFunction, Get-AzStreamAnalyticsDefaultFunctionDefinition, New-AzStreamAnaly...
Script     1.0.1      Az.TrafficManager                   {Add-AzTrafficManagerCustomHeaderToEndpoint, Remove-AzTrafficManagerCustomHeaderFromEndpoint, Add...
Script     1.3.0      Az.Websites                         {Get-AzAppServicePlan, Set-AzAppServicePlan, New-AzAppServicePlan, Remove-AzAppServicePlan...}      
Script     5.1.2      Azure                               {Get-AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAutomationConnection, Re...
Script     0.5.4      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisServicesInstance, Export-AzureAnalysisSer...
Script     0.5.1      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisServicesInstance, Export-AzureAnalysisSer...
Manifest   0.5.0      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisServicesInstance, Export-AzureAnalysisSer...
Script     4.6.1      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New-AzureStorageTableStoredAccessPolicy, N...
Script     4.5.0      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New-AzureStorageTableStoredAccessPolicy, N...
Script     4.3.1      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New-AzureStorageTableStoredAccessPolicy, N...
Script     4.2.1      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New-AzureStorageTableStoredAccessPolicy, N...
Binary     2.0.1.16   AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationExtensionProperty, Ge...
Binary     2.0.1.3    AzureAD                             {Add-AzureADApplicationOwner, Get-AzureADApplication, Get-AzureADApplicationExtensionProperty, Ge...


    Directory: C:\Program Files\WindowsPowerShell\Modules\AzureStack-Tools-master\Identity


ModuleType Version    Name                                ExportedCommands                                                                                    
---------- -------    ----                                ----------------                                                                                    
Script     0.0        GraphAPI                            {Get-GraphApplicationPermissions, New-GraphPermissionDescription, Show-GraphApplicationPermission...


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                    
---------- -------    ----                                ----------------                                                                                    
Manifest   1.1        HybridRunbookWorker                                                                                                                     
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}                                               
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource...}                              
Script     3.4.0      Pester                              {Describe, Context, It, Should...}                                                                  
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}                                        
Script     1.2        PSReadline                          {Get-PSReadlineKeyHandler, Set-PSReadlineKeyHandler, Remove-PSReadlineKeyHandler, Get-PSReadlineO...
Script     1.0.3      PSSQLite                                                                                                                                
Manifest   1.3.0.0    Start-parallel                      Start-Parallel   

Environment Data

PS C:\WINDOWS\system32> $PSVersionTable

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

Is it a known issue? Is the fix for this already in place?

@sphibbs sphibbs added Batch Service Attention This issue is responsible by Azure service team. labels Jul 12, 2019
@matthchr
Copy link
Member

Can you do Uninstall-Module Az.Batch and then Install-Module Az.Batch -AllowPrerelease -RequiredVersion 1.0.1-preview -Repository PSGallery - This should fix this issue I believe.

@bgklein bgklein closed this as completed Jul 16, 2019
@avi1479
Copy link
Author

avi1479 commented Jul 17, 2019

Why closed this issue? This is still not the solution for us.
If this is a known issue or a breaking change, then it should be listed in the breaking changes list.

@matthchr , Running the command that you suggested, Install-Module Az.Batch -AllowPrerelease -RequiredVersion 1.0.1-preview -Repository PSGallery , it's giving me below error

Install-Module : Cannot process argument transformation on parameter 'RequiredVersion'. Cannot convert value "1.0.1-preview" to type "System.Version". Error: "Input string was not in a correct 
format."
At line:1 char:59
+ ... dule Az.Batch -AllowPrerelease -RequiredVersion 1.0.1-preview -Reposi ...
+                                                     ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Install-Module], ParameterBindingArgumentTransformationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Install-Module

Kindly reopen this issue until we get the required solution.

@bgklein
Copy link
Contributor

bgklein commented Jul 17, 2019

Hello @avi1479,

This was closed due to the issue being believed to have a known fix. You will need to upgrade your PowerShellGet to allow Install-Module to recognize the -AllowPrerelease flag (https://stackoverflow.com/questions/56327725/how-to-install-azure-az-cannot-convert-value-2-0-0-preview-to-type-system-v). I had the same issue you did when doing the command, but after upgrading and restarting PowerShell it worked properly.

@matthchr is following up with the PS team to get a 1.1.1-preview version released which applies the patch to the changes in 1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Batch Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

4 participants