msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Bump Newtonsoft.Json from 10.0.3 to 13.0.1 in /src/Authentication/Authentication.Core causes module version conflict - Azure Automation

Open FialaP opened this issue 3 years ago • 6 comments

Hello guys, I have the same issue as was solved here, but in a slightly different environment. I am using Connect-MgGraph in Azure Automation - PowerShell runbook, where only PowerShell runtime version 5.1 or 7.1 (preview) is available (using now 7.1 (preview)). I'm afraid that upgrading to PowerShell runtime version 7.2 is not possible there. Or how to do it?

I also tried to use Microsoft.Graph.Authentication version 1.9.6 as a workaround from powershellgallery, but I can't get this version for PowerShell 7.1 runtime version. When I get it into the runbook via the Azure Automation tab, the runbook cannot find this module probably because of the runtime version 5.1 listed in the runbook modules for that runbook. So second question is how can I get Microsoft.Graph.Authentication version 1.9.6 for Powershell 7.1 runtime version to Azure powershell runbook (workaround)? Or is there any another workaround?

Thanks. PF

FialaP avatar Aug 22 '22 06:08 FialaP

Same issue here! Bricked all our PS 7 Runbooks.

@FialaP can I get Microsoft.Graph.Authentication version 1.9.6 for Powershell 7.1 runtime version to Azure powershell runbook (workaround)?

We managed to achive this by manualy uploading the 1.9.6 Microsoft.Graph Modules to the Automation Account

MichaMican avatar Aug 22 '22 06:08 MichaMican

Experiencing the same issue. A quick fix would be very appreciated.

a-mnich avatar Aug 22 '22 06:08 a-mnich

Same issue here! Bricked all our PS 7 Runbooks.

@FialaP can I get Microsoft.Graph.Authentication version 1.9.6 for Powershell 7.1 runtime version to Azure powershell runbook (workaround)?

We managed to achive this by manualy uploading the 1.9.6 Microsoft.Graph Modules to the Automation Account

@MichaMican Thanks for your response. Can you please describe more "manually uploading the 19.6 Microsoft.Graph Modules to the Automation Account"? Did you achive this through Add a module in Azure portal? Only the zip file can be uploaded there. So where can I get zip file for that module? On Powershellgallery I can find only nupkg file. How can I get zip file from that? I tried creating a zip file directly from nupkg, but the import failed after that. I'm sorry, but I'm completely new to this. Thanks a lot!

FialaP avatar Aug 22 '22 09:08 FialaP

Same issue here! Bricked all our PS 7 Runbooks. @FialaP can I get Microsoft.Graph.Authentication version 1.9.6 for Powershell 7.1 runtime version to Azure powershell runbook (workaround)? We managed to achive this by manualy uploading the 1.9.6 Microsoft.Graph Modules to the Automation Account

@MichaMican Thanks for your response. Can you please describe more "manually uploading the 19.6 Microsoft.Graph Modules to the Automation Account"? Did you achive this through Add a module in Azure portal? Only the zip file can be uploaded there. So where can I get zip file for that module? On Powershellgallery I can find only nupkg file. How can I get zip file from that? I tried creating a zip file directly from nupkg, but the import failed after that. I'm sorry, but I'm completely new to this. Thanks a lot!

@FialaP You can treat the nupkg file as a Zip file - so if you useing 7-Zip - just rightclick on in and open it with 7-Zip - Then you can extract the files rezip it to a propper .zip file and then upload it to the automation account. Make sure you create a Parent folder for the nupkg content. So e.g. Microsoft.Graph.Authentication would then look like:

Microsoft.Graph.Authentication.zip ‎ ‎ ‎ ‎ |— Microsoft.Graph.Authentication ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ |— Microsoft.Graph.Authentication.psm1 ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ |— Microsoft.Graph.Authentication.psd1 ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ |— ...

Alternativately you can install the Version locally and then zip the local Version Folders (also don't forget to create/zip a parent folder with the name of the Module name)

When I was browsing through the powershell galery i also noticed there is the tab "Automation Account" - however i never tried this so i don't know how/if that works and if it installs the selected or most recent version in the Automation Account. image

MichaMican avatar Aug 22 '22 11:08 MichaMican

You can treat the nupkg file as a Zip file - so if you useing 7-Zip - just rightclick on in and open it with 7-Zip - Then you can extract the files rezip it to a propper .zip file and then upload it to the automation account. Make sure you create a Parent folder for the nupkg content. So e.g. Microsoft.Graph.Authentication would then look like:

@MichaMican Much thanks for your advices, this works. So workaround "manually uploading the 1.9.6 Microsoft.Graph Modules to the Automation Account" works fine for me!

BTW: about the tab "Automation Account" - it installs the selected version but I haven't figured out how can I choose Powershell runtime version (every time it installed module for Powershell 5.1 runtime version)

FialaP avatar Aug 22 '22 12:08 FialaP

To be honest I do belive the blame is to put on the Azure Automation team here. PS 7.2 is a LTS version and is a stable (not preview release) since the beginning of this year - yet they still only support PS 7.1. I did create a Q&A entry for this btw: https://docs.microsoft.com/en-us/answers/questions/977821/automation-account-runbook-powershell-72-lts-versi.html let's see if something comes back there.

Don't get me wrong the Powershell Microsoft.Graph SDK team should definately address this issue as the current version practically just does not run on PS 7.1 because they propably do not distinguish between 7.1 and 7.2 when loading dependencies (only between 7 and 5). PS 7.2 does have that particular Newtonsoft Version already backed in where as 7.1 doesn't.

MichaMican avatar Aug 23 '22 06:08 MichaMican

this isn't an issue we can specifically tackle on our side. Refer to the linked issue above for tracking that item.

ddyett avatar Nov 10 '22 17:11 ddyett