Contents

Az.Sql Module won't load

Contents

Today, the Az.Sql module would not load on my machine when attempting to manually fail over a SQL Managed Instance with this error:

https://d33wubrfki0l68.cloudfront.net/6a8bacc5f40d579ecd4da54d3a71a4bb2ea88e23/b0a4c/blog/az-sql-module/2021-03-16_18-19-15.png
module could not be loaded

I followed the advice of the error message and tried to import the module to get further information.

https://d33wubrfki0l68.cloudfront.net/910d35a8b69fa5586bdd00e1a55fc563fd9c9b0b/86724/blog/az-sql-module/2021-03-16_18-19-54.png
module is already loaded

Hmmm 🤔

I decided to uninstall the Azure PowerShell from my machine using the Windows 10 Settings App. Looks like an old version.

https://d33wubrfki0l68.cloudfront.net/f05854eac0dc089714ed737445a81f9636a8b1c6/f62a2/blog/az-sql-module/2021-03-16_18-22-25.png
Uninstall Azure PowerShell

I then tried to reinstall the Az module using PowerShell but it still found an old version in my personal OneDrive\Documents folder.

https://d33wubrfki0l68.cloudfront.net/d8f19c032a6093f7a4900a13fc8d1cde30865c8c/d21cc/blog/az-sql-module/2021-03-16_18-24-00.png
Warning version already installed

I went into Windows Explorer and deleted that, and then all was fine for the installation and the PowerShell cmdlets for Az.Sql worked fine again.

https://d33wubrfki0l68.cloudfront.net/07824fdddfead4751defef5d2aae89f7da5d6c58/d7e18/blog/az-sql-module/2021-03-16_18-27-27.png
Installing module for all users
https://d33wubrfki0l68.cloudfront.net/5fdd2b8a0dd80bf1f152f08472fa12a49f2c4cb6/63c91/blog/az-sql-module/2021-03-16_18-28-51.png
Working fine now