Friday, May 18, 2018

Add-AzureAccount : No subscriptions are associated with the logged in account in Azure Service Management (RDFE).

The Problem

I was following a blog post about migrating my Azure Storage (classic) to "new" Azure Storage (Resource Manager).

In running the following code:

## Register with Migration Service
Login-AzureRmAccount
Get-AzureRMSubscription | Sort SubscriptionName | Select SubscriptionName
$subscr="subscriptionName"
Get-AzureRmSubscription –SubscriptionName $subscr | Select-AzureRmSubscription 
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate 
Get-AzureRmResourceProvider -ProviderNamespace Microsoft.ClassicInfrastructureMigrate

# Prepare Resource for Migration 
Add-AzureAccount
Get-AzureSubscription | Sort SubscriptionName | Select SubscriptionName
$subscr="subscriptionName"
Get-AzureSubscription –SubscriptionName $subscr | Select-AzureSubscription
$storageAccountName = "classStorageResourceName"
Move-AzureStorageAccount -Prepare -StorageAccountName $storageAccountName

## GO CHECK CONFIGURATION THROUGH PORTAL

# Revert Migration Changes
Move-AzureStorageAccount -Abort -StorageAccountName $storageAccountName
# Commit Migration Changes
Move-AzureStorageAccount -Commit -StorageAccountName $storageAccountName

I got an error when attempting to run the section "Prepare Resource for Migration"


Add-AzureAccount : No subscriptions are associated with the logged in account in Azure Service Management (RDFE).


The account i was authenticating from is an Owner of the subscription in question, as well as a Global Administrator on the Office365 account, and Global Administrator for the Azure Active Directory that is federating this subscription.

So i'm sure you can understand that i was a bit confused that although i was able to run the "Register with Migration Service" section of the posh script, that i'd suddenly run into a wall here.



The Solution

Even though my user was an Owner on the subscription, i had to explicitly add myself as a Co-Administrator on the subscription in order to allow myself to be able to see the subscription.

To do that:
1. Go to Subscriptions

2. Navigate to the subscription that your Azure Storage (classic) resource resides on.

3. Navigate to Access control (IAM)
4. From there find the user that you want to make co-administrator and click on the "..." on the right side of the user.

5. Click Add as Co-Administrator


THAT'S IT! You should now successfully be able to run Azure Service Management powershell commands against that subscription! 

No comments :