how to rename azure subscription name through powershell - powershell

i am trying to rename my azure subscription name with powershell
Get-AzureSubscription "Visual Studio Professional with MSDN" | Set-AzureSubscription "MSDN"
but its not working for me .error is below -
Set-AzureSubscription : Cannot bind positional parameters because no names were given.
At line:1 char:64
+ Get-AzureSubscription "Visual Studio Professional with MSDN" | Set-AzureSubscrip ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-AzureSubscription], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousPositionalParameterNoName,Microsoft.WindowsAzure.Commands.Profile.SetAzureSubscriptionCommand

You cannot rename it with PowerShell at the moment.
Here is a list of all supported Azure PowerShell commands related to manage a profile:
https://msdn.microsoft.com/library/dn790379.aspx
You can see that there is is no command to change a subscription name. The only command to change a subscription is the Set-AzureSubscription, but it uses the -SubscriptionName parameter as the identifier:
https://msdn.microsoft.com/library/dn790376.aspx
So basically, with Set-AzureSubscription you can change all other properties except the name.

Related

Login-AzureRmAccount Error after running the command

Getting the below error even though I've Run the Login-AzureRmAccount command and I've also selected my subscription using the Select-AzureRmSubscription command. I'm not sure what could be causing this. any help would be greatly appreciated.
New-AzureRmServiceBusNamespace : Run Login-AzureRmAccount to login.
At line:1 char:2
+ New-AzureRmServiceBusNamespace -ResourceGroup AXFDEVRG -NamespaceNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzureRmServiceBusNamespace], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.ServiceBus.Commands.Namespace.NewAzureRmServiceBusNamespace
According to your error log, you could check as the following ways.
1.Try to create new Serviceus on Azure Portal. Please ensure your subscription has the permission to create SeviceBus.
2.Do you have multiple subscriptions? If yes, please ensure your subscription is correct.
Login-AzureRmAccount
#View all subscriptions for your account
Get-AzureRmSubscription
#Select a default subscription for your current session
Get-AzureRmSubscription –SubscriptionName "your subscription" | Select-AzureRmSubscription
3.If they don't work, please check your Azure PowerShell version.
Get-Module -ListAvailable -Name Azure -Refresh
For now, the latest version is 3.7.0. If your are old version, you could try to install the latest version from the link.

New-AzureRmResourceGroup command not working in powershell

I have logged into my Azure account and selected the appropriate subscription.
But it always gives the same error
PS C:\WINDOWS\system32> New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location "East US"
New-AzureRmResourceGroup : Run Login-AzureRmAccount to login.
At line:1 char:1
+ New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzureRmResourceGroup], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzur
eResourceGroupCmdlet
I have selected the subscription too using select-azuresubscription
select-azuresubscription is used for ASM mode.
For ARM mode, you need use Get-AzureRmSubscription -SubscriptionName "your sub" | Select-AzureRmSubscription to select your subscription.
More information please refer to this example.
Update:
You could use the following cmdlet to check Azure PowerShell version.
Get-Module -ListAvailable -Name Azure -Refresh
You could install the latest PowerShell from the link.
I had the same problem and I solved it by changing the environment setting from Bash to Powershell in the upper left corner of the Cloud Shell Window.

Submit U-SQL Script locally using Powershell

If I want to submit a U-SQL Script to ADLA account, I can do so, using the below powershell cmdlet.
`
Submit-AzureRmDataLakeAnalyticsJob -Account $adlaAccountName -ScriptPath $USQLFile -Name $folder -DegreeOfParallelism $degreeOfParallelism -Verbose`
But, I am not able to submit the script against local ADLA account. I am getting error:
Submit-AzureRmDataLakeAnalyticsJob : Run Login-AzureRmAccount to login.
At line:1 char:1
+ Submit-AzureRmDataLakeAnalyticsJob -Account "local" -ScriptPath GetIn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Submit-AzureRmDataLakeAnalyticsJob], PSInvalidOperationExceptio
n
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyti
csJob
How to submit U-SQL script against local ADLA account ?
In addition to ADL Tools, we have released standalone SDK as well.
https://www.nuget.org/packages/Microsoft.Azure.DataLake.USQL.SDK
And document here:
https://learn.microsoft.com/en-us/azure/data-lake-analytics/data-lake-analytics-data-lake-tools-local-run
Thanks a lot,
Yu Dong

Azure powershell: Account with name '​' does not exist

I am working with classic resources in Azure. I am running Azure powershell version 2.0.1 (updated it to see if that solved the issue below).
I was wanting to check my list of VIPS, and am running some script I had for this in powershell.
$deployment = Get-AzureDeployment -ServiceName servicenamehere
$deployment.VirtualIPs
I am now getting the error
Get-AzureDeployment : Account with name '​' does not exist.
Parameter name: accountName
At line:1 char:15
+ $deployment = Get-AzureDeployment -ServiceName servicenamehere
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureDeployment], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.HostedServices.GetAzureDeploymentCommand
A variety of other statements return with the same error "Account with name '' does not exist." This was all executed after logging in and selecting my subscription, which works fine:
Add-AzureAccount
Select-AzureSubscription -SubscriptionName "subscriptionnamehere"​
Any ideas on what is occurring on the statements that makes them fail with this accountName issue? Unsure if this has to do with resource manager changes or anything else new added in the last few months in Azure.
Other statements fail with the same error. Example
Add-AzureVirtualIP -VirtualIPName newvipname -ServiceName servicenamehere
Gives the same error
Add-AzureVirtualIP : Account with name '​' does not exist.
Parameter name: accountName
You need to add the qouteation mark when adding a string.
Select-AzureSubscription -SubscriptionName "subnamame" -Account "acname"
This is typically required, especially when you have more then 1 parameter.

how do I create a new azure management cache?

Now that Microsoft has completely dropped the GUI support on the management portal, they are requiring me to install and setup and use windows Azure PowerShell to create a new managed cache service. As someone with not a ton of PowerShell experience. I cannot figure out how to successfully create a new azure managed cache. Does anyone have any tips?
I did the following:
executed in PowerShell:
Add-AzureAccount
connected with login to Azure account
executed in PowerShell:
New-AzureManagedCache -Name test -Location "South Central"
and the error is:
New-AzureManagedCache : Value cannot be null.
Parameter name: managementCertificate
At line:1 char:1
+ New-AzureManagedCache -Name test-Location "South Central"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureManagedCache], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ManagedCache.NewAzureManagedCache
What should I do to fix this issue and get a new basic cache 128mb created?
i figured it out - i needed to
get-azurepublishsettingsfile
and then
import-azurepublishsettignsfile "c:\filename.publishsettings"
and then it appears to be creating it now
With explicit sku paramater:New-AzureManagedCache -Name test -Location "South Central" -Sku Basic -Memory 128MB