SQL Azure powershell commands not recognized anymore. Deprecated? - powershell

Already discussed at: Get-AzureSqlDatabaseServer : The term 'Get-AzureSqlDatabaseServer' is not recognized as the name of a cmdlet
I just need to be sure if this behavior is due to the whole Azure Services Management deprecated ? Replaced by AzureRM or is it something else ?

If the cmdlet doesn't start with <verb>-AzureRm* then it's not part of the AzureRm module.
Get-AzureSqlDatabaseServer appears to be part of the Azure module, which is deprecated.
Perhaps you are looking for Get-AzureRmSqlServer?
Get-Help Get-AzureRmSqlServer
NAME
Get-AzureRmSqlServer
SYNOPSIS
Returns information about SQL Database servers.
SYNTAX
Get-AzureRmSqlServer [[-ResourceGroupName] <System.String>] [[-ServerName]
<System.String>] [-DefaultProfile <Microsoft.Azure.Commands.Common.Authenticatio
n.Abstractions.IAzureContextContainer>] [-Confirm
<System.Management.Automation.SwitchParameter>] [-WhatIf
<System.Management.Automation.SwitchParameter>] [<CommonParameters>]
DESCRIPTION
The Get-AzureRmSqlServer cmdlet returns information about one or more Azure SQL
Database servers. Specify the name of a server to see information for only that
server.

Related

how to get calendar item change log?

it's supposoed to work with this commandlet
Get-CalendarDiagnosticObjects
but it's obviously missing from these modules
3.0.0 ExchangeOnlineManagement PSGallery This is a General Availability (GA) release of the Exchange Online Powershell V3 module....
0.11.0 ExchangePowerShell PSGallery The EP (ExchangePowerShell) Powershell module is a collection of commandlets that can be
The term 'Get-CalendarDiagnosticObjects' is not recognized as the name of a cmdlet,
whereas:
Connect-ExchangeOnline
get-mailbox
works fine!
seems that V3 of the module is quite new? any idea?

Powershell: Grant-NfsSharePermission Full Permissions

Powershell v3.0 Windows Server 2012
I am trying to use the Grant-NfsSharePermission cmdlet to grant read/write access to all users with local admins having full permissions to a NFS share.
Grant-NfsSharePermission -Name "LABS" -Path "C:\LABS" -ClientName "WIN-TGE0C741D5G" -ClientType "builtin" -Permission readwrite
The error I get is the parameter set cannot be resolved using the specified name parameters. It's in the InvalidArgument category. After looking at the built-in examples, I can't seem to see why this is a problem. I even tried replacing the clientname (which is my machine name) with localhost and 127.0.0.1 and same error.
The Grant-NfsSharePermission cmdlet expects either the name of the NFS share or the path to the share. You provided both and it doesn't like that. Provide either just -Name or just -Path, but not both and it should work.
As TheMadTechnician mentioned in the comments, you can see this by reviewing the online help or built-in help (with Get-Help Grant-NfsSharePermission) and seeing they provide two parameter sets and the examples only show the use of one or the other.

ArgumentNullException - Get-AzureService

I'm trying to use the Windows Azure PowerShell module to manage a subscription.
I have downloaded my certificate (the .publishsettings file) and imported it with Import-AzurePublishSettingsFile and then I've selected my subscription with Select-AzureSubscription neither of which gave errors.
I've also set my subscription using Set-AzureSubscription -SubscriptionName "Blah"
Still, I get a
Get-AzureService : Value cannot be null.
Parameter name: subscriptionId
when running Get-AzureService
I've read getting started guides and various documentation but I can't work out what I'm doing wrong. Which in my mind, makes this a UX problem that Microsoft should address.
Update
I got a bit further, I used
Set-AzureSubscription -SubscriptionName "Blah" -SubscriptionId 0123
which changed the error from Get-AzureService to:
Get-AzureService : Value cannot be null.
Parameter name: managementCertificate
But now I cannot set my certificate since the argument wants an X509Certificate type.
There is a better way to authenticate when using the Azure Powershell cmdlets --- Add-AzureAccount. This will prompt you for your login credentials instead of using the service management certificate.
You may still run into some issues because Azure powershell caches your subscriptions in XML files in %appdata%\Windows Azure Powershell.
I would recommend:
Close the Azure Powershell window
Delete the XML files in %appdata%\Windows Azure Powershell.
Open Azure Powershell and run Add-AzureAccount.
This should ensure that you have the correct subscriptions configured.
I hope this might help you-
Add-AzureAccount
Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile filenamewithpath
filenamewithpath is the publishsetting file with path saved on your pc

Get Azure VM Detail by PowerShell

I am trying to run Get-AzureVM PowerShell command, it is running fine but not return any output.
Also tried in following flavor but still blank result any idea?
Get-AzureVM -Name "vmname" |Select-Object name,instancesize,location
You should call Select-AzureSubscription "subscription name" first.
It likely is defaulting to a subscription that doesn't have any virtual machines in it.
To view your current subscription names call:
Get-AzureSubscription | select SubscriptionName
Actually the answer above is only semi-correct.
This had me pulling my virutal hair out trying to do automation (which took 7 hours of manual fudging to get working!).
Simply, you have two types of virtual machine in Azure; Classic, and Resource Manager.
If you Switch-AzureMode -name AzureServiceManagement then use Get-AzureVM you will list all of the classic VM's you have created.
If you Switch-AzureMode -name AzureResourceManager then use Get-AzureVM you will list all of the Resource Manager (or new) VM's you have created.
And remember, if you are trying to do automation, then you need the VM's in the new mode available through the portal, your old VM's (classic) that you created through management are not visable in this mode and you will have to recreate them.
Azure has two types of Management System: AzureServiceManagement (ASM) and AzureResourceManager (ARM)
In order to control these two different type of management systems you should switch between them as described in the main page of the Azure Powershell Github project page, but this is true for the azure powershell versions lower than 1.0.0, you can find more explanation in here
For those who are interested to control ARM (AzureResourceManager) with the powershell version greter than 1.0.0, they should use all Cmdlets with the following format : [Verb]-AzureRm[Noun], for example New-AzureVm becomes New-AzureRmVm, in our case Get-AzureVM became Get-AzureRmVm
In summary:
Powershell versions lower than 1.0.0 you should switch between modes and use Get-AzureVM, which is very confusing in my and lots of others opinion
Powershell versions equal or greater than 1.0.0 you should use Get-AzureVM for ASM and Get-AzureRmVm for ARM.
I know this question has been answered but I tried the answer given and it did not work for me. I found, I needed to switch my AzureMode.
To resolve, I ran the following powershell script.
Switch-AzureMode -Name AzureResourceManager
Switching Azure Powershell mode between AzureServiceManagement and AzureResourceManger is a possible solution if your script is using older features as well as new Azure Resource Manager cmdlets. The switch is needed only for Microsoft Azure Powershell version 0.9.8 or older.

Powershell remote access denied

I am trying to start a service on a remote computer using the following command on the cmdlet:
(Get-WmiObject -computer atl-fs-01 Win32_Service -Filter "Name='Alerter'").InvokeMethod("StartService",$null)
When I run the command I get the error Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). After some research it appears I need to set my username and password, but I cannot find anything that allows me to set these prior to accessing the remote computer. I also plan on making a script for this so I don't have to type out everything on the command line. PowerShell code for setting user and password would be helpful as well. Thanks.
You need to pass in the credential object (created with Get-Credential) using the "-Credential" switch.
See this MSDN article for more information and an example.
Chapter 13 (page 502) of Bruce Payette's (UTTERLY AWESOME) "Windows Powershell in Action, Second Edition" comprehensively covers configuration of remote Powershell admin. If you've not already asked Santa for a copy of this wonderful book, DO SO NOW! :)
In case you are in a hurry:
MSDN (and other sources) have some good documentation on how to
Enable remoting to a remote server
Connect from your local server to your remote server & execute commands
HTH.