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.

module
Can someone let me know what I'm doing wrong?

Cheers
LVL 1
Member_2_7966113Asked:
Who is Participating?
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Ah, I see. Run the following on your computer:
Import-Module AzureRM.Network, AzureRM.Profile, AzureRM.Resources

(Get-Module AzureRM.Network,AzureRM.Profile, AzureRM.Resources).Path | Split-Path -Parent | Split-Path -Parent

Open in new window

This will give you the 3 directories that needs to be uploaded to your function app.
0
 
Member_2_7966113Author Commented:
Experts,

I have also tried the following:

netdom
Still no luck
0
 
David Johnson, CD, MVPOwnerCommented:
the proper command is
import-module azure

c:\Program Files (x86)\Microsoft SDKs\Azure\Powershel\ResourceManager\AzureResourcemanager whould be in your $env:PSModulePath
0
On-Demand: Securing Your Wi-Fi for Summer Travel

Traveling this summer?Check out our on-demand webinar to learn about the importance of Wi-Fi security and 3 easy measures you can start taking immediately to protect your private data while using public Wi-Fi. Follow us today to learn more!

 
Member_2_7966113Author Commented:
Hi David,

Thanks for responding.

Going to try your suggestion now.

Cheers
0
 
Member_2_7966113Author Commented:
Hi David,

I'm now getting the following error:

backup
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Don't include the path. Just Import-Module Azure
0
 
Member_2_7966113Author Commented:
Hi Jeremy

Thanks for responding.

Going to try without path now.

Cheers
0
 
Member_2_7966113Author Commented:
Jeremy

Nothing happened

backup
1
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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.
0
 
Member_2_7966113Author Commented:
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.

backup
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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.
0
 
Member_2_7966113Author Commented:
Hi Jeremy

you need to install the Azure Powershell cmdlets on your desktop

This is exactly what I'm trying to do, but failing..
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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)
0
 
Member_2_7966113Author Commented:
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
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
On your computer did you go through the install process outlined in the link I posted?
0
 
Member_2_7966113Author Commented:
Hi Jeremy,

See below
backup
Still can't find the cmdlets

BTW, thanks for your continued support
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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

0
 
Member_2_7966113Author Commented:
Ahhh.... I see what you mean. However, I need to physical grap those cmdlets and upload them elsewhere.
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
??? Not sure what you mean?
0
 
Member_2_7966113Author Commented:
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.

backup

However, I can see the cmdlets that was created with the commnad Import-Module azure
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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

0
 
David Johnson, CD, MVPOwnerCommented:
Install-Module downloads and installs the module
0
 
Member_2_7966113Author Commented:
Trying Install-Module Azure -AllowClobber -Force now
0
 
Member_2_7966113Author Commented:
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
0
 
Member_2_7966113Author Commented:
I thought that the command Import-Module would import the cmdlets onto my computer..
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
I guess I don't understand what you're trying to accomplish. Can you explain what the end goal is?
0
 
Member_2_7966113Author Commented:
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
0
 
Member_2_7966113Author Commented:
Please bear in the mind the file is actually a .psd1 file
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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?
0
 
David Johnson, CD, MVPOwnerCommented:
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.
0
 
Member_2_7966113Author Commented:
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
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Looks like you forgot the link. ;-)
0
 
Member_2_7966113Author Commented:
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
0
 
Member_2_7966113Author Commented:
Hi Jeremy,

Going to try that now.. thanks
0
 
Member_2_7966113Author Commented:
Hi Jeremy,

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

riverbed
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
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.
0
 
Member_2_7966113Author Commented:
Jeremy, that did it mate... thanks soooooooooooooo much
0
 
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.