{"id":7199,"date":"2023-07-17T19:21:06","date_gmt":"2023-07-17T18:21:06","guid":{"rendered":"https:\/\/rakhesh.com\/?p=7199"},"modified":"2023-07-17T19:21:06","modified_gmt":"2023-07-17T18:21:06","slug":"az-module-troubles","status":"publish","type":"post","link":"https:\/\/rakhesh.com\/azure\/az-module-troubles\/","title":{"rendered":"Az Module troubles"},"content":{"rendered":"

I am usually more planned than this, but today I was distracted while on a call and doing some housekeeping on my Hybrid Runbook Workers side by side. I decided to update the Az modules, coz why not.<\/p>\n

Update-Module Az<\/pre>\n

That broke all my Runbooks with the following error:<\/p>\n

Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.<\/pre>\n

\ud83d\ude21<\/p>\n

I tried removing the Az module and installed the previous one in the gallery<\/a>:<\/p>\n

Uninstall-Module Az\r\nInstall-Module Az -RequiredVersion \"10.0.0\"<\/pre>\n

But that didn’t help. I wish I had noted the previous version of the module! Heck, that’s something I should be mindful of going forward. Unlike the Graph, PnP.PowerShell, or ExchangeOnlineManagement modules whose versions I am mindful of, with the Az modules I just update periodically. Never bit me in the a$$ so far.<\/p>\n

Luckily I had a second machine I was using as HRW and I know that works fine.<\/p>\n

So I did the following on that machine:<\/p>\n

foreach ($entry in (Get-InstalledModule | Where-Object { $_.Name -match \"^Az\" })) {\r\n\t\"$($entry.Name),$($entry.Version)\" | Out-Files .\\azlist.txt -Append\r\n}<\/pre>\n

This outputs the modules and their versions. I am capturing the info for all the Az.* modules as they all depend on each other. Initially I tried just uninstalling the main Az module and installing the specific version of that but it didn’t help. (Could be I was doing something wrong and this roundabout way is not needed)<\/em>.<\/p>\n

Then on the broken machine I did:<\/p>\n

$hashTable = @{}\r\n# Cache the existing versions beforehand to speed things up\r\nforeach ($module in Get-InstalledModule) {\r\n\t$hashTable[$module.Name] = $module.Version\r\n}\r\n\r\nGet-Content .\\azlist.txt | ForEach-Object {\r\n\t$module = ($_ -split ',')[0]\r\n\t$version = ($_ -split ',')[1]\r\n\r\n\tWrite-Host \"Processing $module\"\r\n\r\n\t$installedVersion = $hashTable[$module]\r\n\tif ($installedVersion -ne $version) {\r\n\t\tWrite-Host \"Uninstalling $module\"\r\n\t\tUninstall-Module -Name $module -Force\r\n\t\tWrite-Host \"Installing $module version $version\"\r\n\t\tInstall-Module -Name $module -RequiredVersion $version\r\n\t\r\n\t}\r\n}<\/pre>\n

Took a while but finally it was done. Now the Runbooks are happy.<\/p>\n","protected":false},"excerpt":{"rendered":"

I am usually more planned than this, but today I was distracted while on a call and doing some housekeeping on my Hybrid Runbook Workers side by side. I decided to update the Az modules, coz why not. Update-Module Az That broke all my Runbooks with the following error: Method ‘get_SerializationSettings’ in type ‘Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient’ from … Continue reading Az Module troubles<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[887],"tags":[1043,383,1110,227,1044],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7199"}],"collection":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/comments?post=7199"}],"version-history":[{"count":1,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7199\/revisions"}],"predecessor-version":[{"id":7200,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/posts\/7199\/revisions\/7200"}],"wp:attachment":[{"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/media?parent=7199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/categories?post=7199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rakhesh.com\/wp-json\/wp\/v2\/tags?post=7199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}