Link to home
Start Free TrialLog in
Avatar of Member_2_7966113
Member_2_7966113

asked on

Microsoft Azure Import Module Assistance

Hello Experts

I'm trying to import modules using Powershell. However, when I issue the command, I don't get any errors, see image however, none of the modules are imported.

User generated image
Can someone let me know what I'm doing wrong?

Cheers
Avatar of Member_2_7966113
Member_2_7966113

ASKER

Experts,

I have also tried the following:

User generated image
Still no luck
Avatar of David Johnson, CD
the proper command is
import-module azure

c:\Program Files (x86)\Microsoft SDKs\Azure\Powershel\ResourceManager\AzureResourcemanager whould be in your $env:PSModulePath
Hi David,

Thanks for responding.

Going to try your suggestion now.

Cheers
Hi David,

I'm now getting the following error:

User generated image
Don't include the path. Just Import-Module Azure
Hi Jeremy

Thanks for responding.

Going to try without path now.

Cheers
Jeremy

Nothing happened

User generated image
It's now imported and the commands are usable. Run GCM -Module Azure* and you will see all the available commands in the Azure modules.
OK, Jeremy, that's great, but I would like those cmdlets to be transferred to my desktop.

For example, there is a cmdlet called Get-AzureRmNetworkWatcher , see image, but I can't find that cmdlet on my desktop when I do a search for it.

User generated image
You need to install the Azure Powershell cmdlets on your desktop then. You can follow these steps:
https://docs.microsoft.com/en-us/powershell/azure/install-azurerm-ps
Just change AzureRM to Azure and it will install all the Azure modules.
Hi Jeremy

you need to install the Azure Powershell cmdlets on your desktop

This is exactly what I'm trying to do, but failing..
What version of Windows are you running on your desktop?
Were you running the powershell commands on another computer when you imported the module? (i.e. when you ran Import-Module azure)
Windows 10 Professional.

No, I wasn't running the commands on another computer when I rean Import-Module azure

Just so you know I can see all the cmdlets when I do GCM -Module Azure*, but I can't see any of them on my computer
On your computer did you go through the install process outlined in the link I posted?
Hi Jeremy,

See below
User generated image
Still can't find the cmdlets

BTW, thanks for your continued support
When you run Import-Module <insert module name> it won't show you anything unless something is wrong. So since you didn't get an error the commands should now be available to use in that session.

You may want to also run this to install all the Azure modules:

Install-Module Azure -AllowClobber -Force
Import-Module Azure

Open in new window

Ahhh.... I see what you mean. However, I need to physical grap those cmdlets and upload them elsewhere.
??? Not sure what you mean?
ok, so for example I can physically access (copy, delete etc) the following cmdlets from the Azure folder that was created when I installed Azure Powershell, see image.

User generated image

However, I can see the cmdlets that was created with the commnad Import-Module azure
I'm not sure exactly all that the install process does. But you could try copying the Azure/Powershell folder to another computer and see if it works. But why not just install on the computer in question? If you're running Windows 10 it's just one line to install:
Install-Module Azure -AllowClobber -Force

Open in new window

Install-Module downloads and installs the module
Trying Install-Module Azure -AllowClobber -Force now
Ok, so I ran ' Install-Module Azure -AllowClobber -Force' and everthing seemed to go fine with no errors, but I still can't find any cmdlets on my computer.

Just so you know, all this is taking place on a single computer
I thought that the command Import-Module would import the cmdlets onto my computer..
I guess I don't understand what you're trying to accomplish. Can you explain what the end goal is?
ok, in the attached file, you will see a whole bunch of cmdlets, in particular, Get-AzureRmNetworkWatcherNextHop. I would like all of the files in the attached downloaded to my PC.

Or maybe that's not possible
AzureRM.Network.txt
Please bear in the mind the file is actually a .psd1 file
1. those are already on your computer and available to use. That's what the install process did.
2. Let's go a little bigger picture. What are you needing to do with the commands and how would you like to run them? Or what is the issue you're trying to solve?
https://msdn.microsoft.com/en-us/library/dd878324(v=vs.85).aspx
Module Manifests
A module manifest is a .psd1 file that contains a hash table. The keys and values in the hash table do the following things:
Describe the contents and attributes of the module.
Define the prerequisites.
Determine how the components are processed.
Sorry for the delayed response, I had to run to catch my train...

OK, lets get to the meat and bones of what I'm trying to do. If you take a look at the following link I'm trying to 'Add modules' to the folder as described in the link,


Now, near the bottom of the page the document specifies Add Powershell function. In the script that follows, there is a line of code which states

$networkWatcher = Get-AzureRmNetworkWatcher -Name $nw.Name -ResourceGroupName $nw.ResourceGroupName

Now, when I run the function, the function states it can't find the Get-AzureRmNetworkWatcher cmdlet. It is that cmdlet that I need to upload to the folder AzureRM.Network.

I hope one of you guys is familiar with functions

Cheers
Looks like you forgot the link. ;-)
Now that you want the real meat the following is the error that I get when I run the function:


Get-AzureRmNetworkWatcher : The term 'Get-AzureRmNetworkWatcher' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at run.ps1: line 34
+ Get-AzureRmNetworkWatcher
+ _________________________
    + CategoryInfo          : ObjectNotFound: (Get-AzureRmNetworkWatcher:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Get-AzureRmNetworkWatcherPacketCapture : The term 'Get-AzureRmNetworkWatcherPacketCapture' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at run.ps1: line 37
+ Get-AzureRmNetworkWatcherPacketCapture
+ ______________________________________
    + CategoryInfo          : ObjectNotFound: (Get-AzureRmNetworkWatcherPacketCapture:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Get-AzureRmNetworkWatcherPacketCapture : The term 'Get-AzureRmNetworkWatcherPacketCapture' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at run.ps1: line 46
+ Get-AzureRmNetworkWatcherPacketCapture
+ ______________________________________
    + CategoryInfo          : ObjectNotFound: (Get-AzureRmNetworkWatcherPacketCapture:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Exception while executing function: Functions.AlertPacketCapturePowerShell
Microsoft.Azure.WebJobs.Host.FunctionInvocationEx…

Now you can see why I need the cmdlets
ASKER CERTIFIED SOLUTION
Avatar of Jeremy Weisinger
Jeremy Weisinger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Jeremy,

Going to try that now.. thanks
Hi Jeremy,

Before I upload the files.. I should mention the following are already uploaded (in particular AzureRM.Network

User generated image
You can then just upload the others. But you may want to upload all so that you make sure it's all the same version. Also, this explains why the cmdlets are not working. azurerm.network depends on azurerm.profile.
Jeremy, that did it mate... thanks soooooooooooooo much
Glad to help. :)