Missing Azure cmdlets from PowerShell v5 - powershell

Alrighty so I am trying to control my first Azure instance with Powershell.
I am on windows 10, I run $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I am trying to follow this guide: https://msdn.microsoft.com/en-us/library/mt125356.aspx
So I type "Install-Module AzureRM" That works
Then I type "Install-AzureRM"
I get:
Install-AzureRM : The term 'Install-AzureRM' 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 line:1 char:1
+ Install-AzureRM
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Install-AzureRM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I can use "Login-AzureRmAccount" and see my subscription info. But if I attempt to use
PS C:\WINDOWS\system32> Remove-AzureADGroup
Remove-AzureADGroup : The term 'Remove-AzureADGroup' 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 line:1 char:1
+ Remove-AzureADGroup
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Remove-AzureADGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\WINDOWS\system32> Get-MsolGroup
Get-MsolGroup : The term 'Get-MsolGroup' 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 line:1 char:1
+ Get-MsolGroup
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MsolGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Nothing is working, and every single guide I come across seems outdated by two years and refers to V2 or below for Azure PS connections.
My end goal it to delete a group from AD via cmdlet and I just cannot seem to get any of this to work.

I......feel....really silly.
So after I posted this, I came across another technet link buried in another technet blog.
Turns out I don't need ANY of the above (for what I am trying to accomplish)
Simply followed this:
https://learn.microsoft.com/en-us/azure/xplat-cli-install#option-2-use-an-installer
Then used these:
https://learn.microsoft.com/en-us/azure/virtual-machines/azure-cli-arm-commands#azure-account-manage-your-account-information

The referenced article is really, really, really old, and you are now redirected to the new page if you attempt to go there: https://learn.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-4.1.0 . You should only need to run
Install-Module AzureRM
Also, the AzureAD module isnot part of AzureRM. There are a small set of AD cmdlets included in AzureRM that allow you to manipulate AAD users, groups, and applications, but it does not have the full AD and MS Graph support of the AzureAD mdoule

Related

PowerShell does not recognize the command Resolve-DnsName

Error on power shell script,
Import-Module DnsClient
Import-Module : The specified module 'DnsClient' was not loaded because no
valid module file was found in any module directory.
At line:1 char:1
+ Import-Module DnsClient
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (DnsClient:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
Resolve-DnsName
Resolve-DnsName : The term 'Resolve-DnsName' 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 line:1 char:1
+ Resolve-DnsName
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Resolve-DnsName:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\aquib> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
Resolve-DnsName is one of the commands added in Windows 8/Windows 2012 and later. By design, it is not available on versions of Windows prior to that regardless of which version of PowerShell you use. The command is unavailable on Windows 7 and Windows 2008 R2 and earlier. Most sources I've read say that the underlying WinAPI functions that the command depends upon were added in Windows 8/2012.
I would recommend using [System.Net.Dns]::GetHostEntry($HostnameOrIP) or one of the other non-obsolete static methods in that class. However, that only works for A, AAAA, and PTR records, and there isn't a class in the .Net Framework CLR for generic DNS requests. You'd have to roll your own or use a third-party library like ARSoft.Tools.Net.

Linux Powershell client : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer

Please advice me how to use : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer on a Linux Ubuntu Powershell client
Here is what I tried:
#$psversiontable Output
Name Value
---- -----
PSVersion 6.1.0-preview.2
PSEdition Core
GitCommitId v6.1.0-preview.2
OS Linux 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
#Connect-VBRServer Output:
Connect-VBRServer : The term 'Connect-VBRServer' 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 line:1 char:1
+ Connect-VBRServer
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-VBRServer:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
#Add-PSSnapin VeeamPSSnapIn Output:
Add-PSSnapin : The term 'Add-PSSnapin' 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 line:1 char:1
+ Add-PSSnapin VeeamPSSnapIn
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-PSSnapin:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
According to Veeam Knowledge Base the PowerShell Module is installed with a Windows Setup File. Maybe ask Veeam directly if it's planned to support Linux?

'New-SelfSignedCertificate' is not recognised as the name of a cmdlet [duplicate]

On a Windows 7 Professional system, it seems not possible to run New-SelfSignedCertificate. I could on a Windows 10 system.
Yes, the shell was started with "Run As Administrator."
PS C:\> new-selfsignedcertificate
new-selfsignedcertificate : The term 'new-selfsignedcertificate' 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 line:1 char:1
+ new-selfsignedcertificate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (new-selfsignedcertificate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 117
As stated in the comments above, this isn't available in Windows 7.
However, if you're looking for something with a similar API and capability, then I have used & can recommend this from Microsoft Script Centre:
https://gallery.technet.microsoft.com/scriptcenter/self-signed-certificate-5920a7c6
Have to install AzureRM module to use azure commands through powershell. You can use below command to do it.
Install-Module -Name AzureRM -AllowClobber

The term 'Set-AzureKeyVaultKeyAttributes' is not recognized as the name of a cmdlet,

On my Windows 10 I've Powershell 5.0 installed. But when I run the following command on it, I get the above error.
PS command:
Set-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest -Enable $false
Error
Set-AzureKeyVaultKeyAttributes : The term 'Set-AzureKeyVaultKeyAttributes' 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 line:1 char:1
+ Set-AzureKeyVaultKeyAttributes -Name Key2 -VaultName KayVault-abctest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-AzureKeyVaultKeyAttributes:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Note
I'm using the topic Create a Key (Portal) in this official Azure lab tutorial.
I believe the name of the cmdlet should be the singular Set-AzureKeyVaultKeyAttribute, rather than the plural Set-AzureKeyVaultKeyAttributes. Note that this is one of the Strongly Encouraged Development Guidelines for Powershell by Microsoft:
To enhance the user experience, the noun that you choose for a cmdlet name should be singular. For example, use the name Get-Process instead of Get-Processes. It is best to follow this rule for all cmdlet names, even when a cmdlet is likely to act upon more than one item.
If you are still seeing the same problem while using a singular name, ensure that the AzureRM.KeyVault module is installed and loaded:
Install-Module AzureRM.KeyVault
Import-Module AzureRM.KeyVault

Microsoft Azure Powershell error - register-AzureProvider

Here is the error with --> register-AzureProvider
PS C:\> register-AzureProvider -ProviderNamespace Microsoft.DevTestLab
register-AzureProvider : The term 'register-AzureProvider' 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 line:1 char:1
+ register-AzureProvider -ProviderNamespace Microsoft.DevTestLab
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (register-AzureProvider:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
If you're using Azure PowerShell Cmdlets version 0.9.8 (or earlier), you will need to do the following first:
Switch-AzureMode AzureResourceManager
Please refer to the documentation on using Using Azure PowerShell with Azure Resource Manager here: https://azure.microsoft.com/en-in/documentation/articles/powershell-azure-resource-manager/.