I have installed Azure powershell 1.0.0 released 3 days ago. and trying to create a new azure resource group using this command
New-AzureRMResourceGroup
Before this when I run Login-AzureRMAccount and supply it with my subscription ID(as I am linked with more than one subscription).
Login-AzureRMAccount -SubscriptionID ""
This strangely tells me , my email id does not have rights to this subscription. It's weird because I can login to this subscription alright and can do things through portal.
When I try to do this using Set-AzureSubscription Select-AzureSubscription and then create resource group. New Resource group is always created in my first subscription... Not sure what's going on.
I had the same issue and following this thread led me to provide the -tenantID parameter in addition to the -subscriptionID of the desired subscription to the Login-AzureRMAccount cmdlet, and got around the issue.
New items began to appear under the account I was expecting.
Related
I am trying to login to Azure AD using PowerShell with a co-administrator account. I use Connect-MsolService and I get in but I can't see any subscriptions when I use Get-AzureSubscription. At the same time, I can login in the portal (both old and new) using that account and I see it there. The issue is I need to do some things that both portals do not let me do.
Is there an issue if I created the subscription using a Microsoft account on outlook.com? Am I missing something?
Just to add to the discussion, if you're not a direct owner of the subscriptions (but have an admin role for the whole or part of the Azure infrastructure) you can use the following cmdlets to get all subscriptions and switch between them:
Get-AzureRmSubscription
Select-AzureRmSubscription -SubscriptionName "subscription_name"
https://learn.microsoft.com/en-us/powershell/module/azurerm.profile/get-azurermsubscription?view=azurermps-5.0.0
This lists the available subscriptions for co-admins and contributors and can be used in Azure resource management scripts if you do not directly own the subscription but have sufficient privileges to access the resources.
Do you get a sign in dialgoue when you run Add-AzureAccount from powershell?
Can you then Get-AzureSubscription after that?
These guides might help in ensuring all the basics work:
https://redmondmag.com/articles/2016/01/25/connect-to-microsoft-azure-with-powershell.aspx
https://azure.microsoft.com/en-gb/documentation/articles/powershell-install-configure/
Update:
What are you trying to do after?
If you want to switch subscriptions, does the following work?:
Switch-AzureMode –Name AzureResourceManager
Get-AzureSubscription
Ref:
https://msdn.microsoft.com/en-us/library/azure/dn931949.aspx
I'm trying to manage an Azure SQL Datawarehouse, specifically pause it in the evenings when nobody is using it. I've downloaded, logged in, and can successfully mange other resources using PowerShell ISE. However, when I go to pause the instance it says invalid Resource Group.
When I call Get-AzureRmResourceGroup only a few show up, at least 8 are missing. Everything is visible in the azure portal.
Calling Select-AzureRmSubscription -SubscriptionId xxx (not Select-AzureSubscription -SubscriptionId xxx - note the "RM" in the middle of the correct call) should allow you to specify the appropriate subscription to see the resources you're looking for with Get-AzureRmResourceGroup.
More info on Select-AzureRmSubscription.
I never used Azure PowerShell before, but now I'm running a command to have Azure reserve a static IP address:
New-AzureReservedIP –ReservedIPName "137.117.11.18" –Label "people-dns-ip" –Location "US West"
And then I'm getting this error: New-AzureReservedIP : No default subscription has been designated.
So, I was trying to figure out what is the or just set to default... using the command Select-AzureSubscription I can see that The subscription name BizSpark doesn't exist.
Not sure how to print the value of Get-AzureSubscription on the screen, but in my Azure portal is says: SUBSCRIPTION NAME BizSpark
Any idea how to resolve this? or maybe this option is limited for BizSpark users??
To use Azure Powershell at very first you should use
Add-AzureAccount
it will give you a popup where you can login with you azure credentials. this way you will connect to your Azure subscription in Azure Powershell
Need to add your azure account to be able to manage assets:
If for some reason method 1 doesn't work, try method 2.
Method 1:
At powershell, run:
Add-AzureAccount
Method 2:
At powershell, run:
Get-AzurePublishSettingsFile
Sign in to the Windows Azure Management Portal, and then follow the instructions to download your Windows Azure publishing settings.
Again at powershell, run:
Import-AzurePublishSettingsFile <mysettings>.publishsettings
Replace with the file name of the publishsettings file that you downloaded in the previous step and correct the path if necessary.
I'm trying to compose a Azure Runbook for starting an Azure Website but keep getting the following two errors
Select-AzureSubscription : The subscription named
'vslaazuresubscription' cannot be found. Use Set-AzureSubscription to
initialize the subscription data.
Start-AzureWebsite : No current subscription has been designated. Use
Select-AzureSubscription -Current to set the
current subscription.
My Runbook is as follows
My Assets are as follows
I was trying to follow the SO Answer here to no avail. I have checked that
I have a subscription by that name
The admin#vslaactivedirectory.onmicrosoft.com exists in active directory configured for the subscription.
Please help. Thanks in advance.
Are you sure "vslaazuresubscription" is the name of your Azure subscription, and that admin#vslaactivedirectory.onmicrosoft.com is configured as an admin of the vslaazuresubscription subscription?
If you run Get-AzureSubscription after Add-AzureAccount, does it output vslaazuresubscription as one of the available subscriptions?
I have two subscription one with old cloud service and other is with new cloud service. I am using Powershell to access my new subscription. I have downloaded latest .publishsettings and set it using Import-AzurePublishSettingsFile. My problem is that I always get the old subscription set and could not figureout how to force powershell to use my new subscription.
Just to clarify, there are two kinds of 'special' subscriptions, the 'current' subscription (which is the subscription used for any command in the current PowerShell session), and the Defaul subscription, which is the subscription used even after the current PowerShell session ends.
using Select-AzureSubscription <subscription-name> will set the current subscription. If you'd like to change the subscription across sessions, use Select-AzureSubscription -Default <subscription name>
With new Powershell commands you would need to set which particular subscription you would want to use. The steps are as below:
Import-AzurePublishSettingsFile yourpublishsettings.publishsettings
Get-AzureSubscription (this will give you the list of subscription)
Select-AzureSubscription _select_subscription_name (this way you can set which particular subscription you want to use)
This should work!!
This answer is for the classic Azure management. If you're on the new ARM then you want to do something like
Login-AzureRmAccount
Get-AzureRmSubscription
Set-AzureRmContext -SubscriptionId blah
where blah is the subscription ID from the second command