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

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.

Related

powershell returned an error:(403) WebException using New-pnpList

I had my PS script running the other day and created a new list with a single field with no issues. Was able to view the list in the Site Contents lib.
Today, it's not working. I tried running the PS code below and then resorted to running the new-pnplist code at the command line...got the same error which is shown below.
I'm using the Global admin account. Using version 3.13.19 SharePointPNPPowerShellOnline. Executed the commands from Powershell ISE which is what I did the other day when it worked. And, I was able to connect successfully using the Connect-sposervice command.
Error:
new-pnplist -Template GenericList -Title 'TestPNP2'
new-pnplist : The remote server returned an error: (403) Forbidden.
At line:1 char:1
+ new-pnplist -Template GenericList -Title $ListName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [New-PnPList], WebException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Lists.NewList
Code:
$TargetListURL="https://<my sharepoint.com>/sites/CKCDemo"
$ListName="TESTPNP2"
Connect-PnPOnline -url $TargetListURL -CurrentCredentials
New-PnPList -Template GenericList -Title $ListName
Add-PnPField -List $ListName -DisplayName "MyTEST" -InternalName "MyTEST" -Type Text -AddToDefaultView
Get-PnPList`
Make sure you have enough permission to create a list in this site. You could try to go to the site directly, check whether you could create a list through ui.
Note: A global admin will not automatically have access to individual sites unless explicitly granted.

PowerShell Error while using the AzureRM Module - HTTP Status Code: NotFound

Calling all PowerShell gurus!
I'm trying to use the Get-AzureRmDataFactoryV2ActivityRun cmdlet in the azurerm PowerShell Module.
When I attempt a query, it says:
Get-AzureRmDataFactoryV2ActivityRun : HTTP Status Code: NotFound
Error Code: NotFound
Error Message: Operation returned an invalid status code 'NotFound'
Request Id: aea5f9c5-fced-4b03-929f-e071eaeb0d9e
Timestamp (Utc):10/25/2017 19:56:43
At line:1 char:1
+ Get-AzureRmDataFactoryV2ActivityRun -DataFactoryName nwmovdatafactory ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmDataFactoryV2ActivityRun], ErrorResponseException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.GetAzureDataFactoryActivityRunCommand
If I try and use the previous implementation of this cmdlet, Get-AzureRmDataFactoryRun it works just fine. HOWEVER, it will ALSO throw the same error as above if I do not first Select-AzureRMSubscription.
Furthermore, Select-AzureRMSubscription before running Get-AzureRMDataFactoryV2ActivityRun DOES NOT resolve the issue. Is there a different way I should be setting my active subscription? Or is just just a fake solution?
EDIT:
Login-AzureRMAccount -SubscriptionID SUBID
Get-AzureRmDataFactoryRun -DataFactoryName DATAFACTORY -DatasetName DATASET -StartDateTime 2017-10-25T19:34:18+00:00 -ResourceGroupName RESGROUP
Will work.
Login-AzureRMAccount -SubscriptionID SUBID
Get-AzureRmDataFactoryV2ActivityRun -DataFactoryName DATAFACTORY -ResourceGroupName RESGROUP -PipelineRunId PIPELINENAME -RunStartedAfter 2017-10-25T19:34:18+00:00 -RunStartedBefore 2017-10-26T19:34:18+00:00
Will not work.
It appears the answer to this question is that DataFactoryv2 is an entirely different resource.
https://learn.microsoft.com/en-us/azure/data-factory/introduction

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-AzureQuickVM not creating VM on exsisting Cloud Service?

I'm trying to run the following Azure Powershell cmdlet to provision a new Virtual Machine on a existing Cloud Service.
PS C:\> Get-AzureService | ft ServiceName
ServiceName
-----------
$AZURETEST-EUWEST0
$AZURETEST-JPWEST0
$AZURETEST-USEAST0
$AZURETEST-USWEST0
PS C:\> $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201505.01-en.us-127GB.vhd"
PS C:\> New-AzureQuickVM -Windows -ServiceName "$AZURETEST-USEAST0" -name "AZURESVM-USE1" -ImageName $image -Password Password1 -AdminUsername admin -WaitForBoot
New-AzureQuickVM : ResourceNotFound: The deployment name '$AZURETEST-USEAST0' does not exist.
At line:1 char:1
+ New-AzureQuickVM -Windows -ServiceName "$AZURETEST-USEAST0" -name "AZURESVM-USE1" -Im ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureQuickVM], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewQuickVM
New-AzureQuickVM : Sequence contains no matching element
At line:1 char:1
+ New-AzureQuickVM -Windows -ServiceName "$AZURETEST-USEAST0" -name "AZURESVM-USE1" -Im ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureQuickVM], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.PersistentVMs.NewQuickVM
PS C:\>
What doesn't make sense is I'm getting an error that says my Cloud Service - or Deployment Name doesn't exist when you can clearly see it returned when I listed all the available Cloud Services!
First of all, admin as administrator account name will not work. It's a reserved word, once you get past the service name, it will break on this one.
Second, there's nothing wrong with your powershell command and I tested exactly with the same parameters to make sure. I can bet it's the "$" you used for the cloud service name that is being misinterpreted by the cmdlet.
Since you can't rename cloud services, create a new one without the "$" and try again to see if it works.
Update: This is what happens when i try to create CS from the portal with the "$" as first character:
"This field can contain only letters, numbers, and hyphens. The first
and last character in the field must be a letter or number.
Trademarks, reserved words, and offensive words are not allowed."
Try to enter all parameters inline without using named parameters (e.g $image). that solved it for me.
Here is a working example:
$image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-20160229-en.us-127GB.vhd"
$location = 'West Europe'
New-AzureQuickVM -Windows -Location $location -ServiceName "RamiSOTest1-cs" -name "RamiSOTest1-VM" -ImageName $image -Password 'RamiPass-1' -AdminUsername 'rami' -WaitForBoot

how to rename azure subscription name through 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.