# Connect-AzContainerRegistry command not working

**URL:** <https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646>\
**Category:** PowerShell Help\
**Created:** [March 30, 2025, 2:58am UTC](https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646 "2025-03-30T02:58:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anishuq](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/anishuq/32/5964_2.png) [@anishuq](https://forums.powershell.org/u/anishuq)\
**Post date:** [March 30, 2025, 2:58am UTC](https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646/1 "2025-03-30T02:58:10Z")

</div>

Hi folks,  
I can connect to my Azure account and my subscription using  
`Connect-AzAccount -Subscription` and `Set-AzContext -Subscription` commands. I have created storage accounts, VMs etc. without a hitch using Powershell. However, when I am trying to use `Connect-AzContainerRegistry`, I am getting the error:

```auto
Connect-AzContainerRegistry : The 'Connect-AzContainerRegistry' command was found in the 
module 'Az.ContainerRegistry', but the module could not be loaded. For more information, run 
'Import-Module Az.ContainerRegistry'.
At line:6 char:1
+ Connect-AzContainerRegistry -Name containerregistrydemo160980
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Connect-AzContainerRegistry:String) [], Comma 
   ndNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

```

And when I try to import the module, I get:

```auto
Import-Module : Could not load file or assembly 'file:///C:\\\OneDrive\Documents\Wi
ndowsPowerShell\Modules\Az.ContainerRegistry\2.2.3\Microsoft.Azure.Management.ContainerRegist
ry.dll' or one of its dependencies. The cloud file provider is not running. (Exception from 
HRESULT: 0x8007016A)
At line:1 char:1
+ Import-Module Az.ContainerRegistry
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException
    + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportM 
   oduleCommand

```

I am not an expert in Powershell. I am using Visual studio 2022, WSL 2. Please help.

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [March 30, 2025, 9:30pm UTC](https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646/2 "2025-03-30T21:30:20Z")

</div>

A M ANISUL HUQ,  
Welcome to the forum. 👋🏼

When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you potentially wasting their time.

Thanks

[reddit.com - Connect-AzContainerRegistry command not working](https://www.reddit.com/r/PowerShell/comments/1jn7e81/connectazcontainerregistry_command_not_working/)

---

<div class="post-metadata">

**Author:** ![anishuq](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/anishuq/32/5964_2.png) [@anishuq](https://forums.powershell.org/u/anishuq)\
**Post date:** [March 30, 2025, 10:20pm UTC](https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646/3 "2025-03-30T22:20:00Z")

</div>

Hey sorry about that. The solution is by going to “C:.…\OneDrive\Documents\WindowsPowerShell\Modules” location \> Selecting everything \> set “always keep on this device”.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 29, 2025, 10:20pm UTC](https://forums.powershell.org/t/connect-azcontainerregistry-command-not-working/25646/4 "2025-04-29T22:20:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
