locked
Resource group could not be found RRS feed

  • Question

  • I have Powershell scripts, which worked in one VM, but not working in another VM. I'm using PowerShell 5.1.2 and CLI 2.0.65. I wonder what is wrong.  Login takes place and I get all available subscriptions listed, but scripts do find resource groups and resources. This happens to all scripts.

    ]
    New-AzAnalysisServicesServer : Resource group 'Dev-RG' could not be found.
    At C:\Infra\Create_Analysis_Services_FP.ps1:30 char:1
    + New-AzAnalysisServicesServer -ResourceGroupName $resourcegroupname -N ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [New-AzAnalysisServicesServer], CloudException
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.AnalysisServices.NewAnalysisServicesServer


    #Login
    az login
    az account set --subscription "1111111111111111111111111"  

    # The data center and resource name for your resources
    $resourcegroupname = "Dev-RG"
    $location = "WestEurope"
    $AnalysisServicesServerName = "as1"

    New-AzAnalysisServicesServer -ResourceGroupName $resourcegroupname -Name $AnalysisServicesServerName -Location $location -Sku D1 -Administrator "john.smith@company.com"


    Kenny_I

    Tuesday, May 28, 2019 3:23 PM

Answers

  • Hello TommyWebApp,

    Thanks very much for that hint! That is definitely something to verify and correct if not configured right.

    Kenny,

    Thanks for checking. Here is how you can fix it:

    Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"

    Hope this helps!


    Tuesday, May 28, 2019 4:44 PM

All replies

  • Hello Kenny_I,

    To start troubleshooting the issue, can you please run this command and let me know if you see the expected output:

    az account show

    Also, were you able to check the existence of the mentioned resource group (Dev-RG) in the Azure Portal?
    Tuesday, May 28, 2019 3:37 PM
  • Hi Kenny, 

    This might be a stupid question, but are you setting the PowerShell subscription to "1111111111111111111111111"

    You can set the subscription you are running against for both CLI and AZ. So it might be that you are setting CLI to "1111111111111111111111111" and then running "New-AzAnalysisServicesServer" against a different subscription. 

    Check with Get-AzContext this should show you the sub you are running against.

    Sorry if this is totally wrong, but worth a check right :) ?

     

    Tuesday, May 28, 2019 3:44 PM
  • az account show list correctly the subscription where I would like to deploy resources.

    Get-AzContext list wrong subscription. It seem like my powershell is trying to find RG from this subscription. I probably have used previously this PowerShell instance for another subscription and somehow Az think make wrong assumption about my targe subs. 

    How to fix?


    Kenny_I

    Tuesday, May 28, 2019 4:42 PM
  • Hello TommyWebApp,

    Thanks very much for that hint! That is definitely something to verify and correct if not configured right.

    Kenny,

    Thanks for checking. Here is how you can fix it:

    Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"

    Hope this helps!


    Tuesday, May 28, 2019 4:44 PM