none
Problem using Automation Scripts for Azure Resource Manager templates RRS feed

  • Question

  • So I've been trying to use Automation Scripts in C#.

    I downloaded the template and parameters file, created a test windows forms applications, tooks the sample .NET code and used the correct values for tenant, and credentials.

    The applications passes the Silent Login stage.

    However, when it tries to verify the existence of a Resource Group I get "Forbidden".

    if (resourceManagementClient.ResourceGroups.CheckExistence(resourceGroupName) != true)

    I even tried to set all of the permissions to the Azure Ad Native Application, though still I get this issue.

    Any ideas what is the reason for the problem?

    Thanks


    Eduardo Fonseca

    Friday, July 21, 2017 1:47 AM

All replies

  • You will get “Forbidden” error, when you pass incorrect values for SubscriptionID, TenantId, and ClientId in the C# code.

    Make sure you are passing correct values.

    -----------------------------------------------------------------------------------------------

    Do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Friday, July 21, 2017 7:18 AM
    Moderator
  • Worked for me; thank you. 

    But it's weird; I was using the ResourceManagementClient > ResourceGroups > CheckExistence method and I was passing in the resource group name as a parameter (everything else was right).

    When I pass in the name of a group that does exist I am returned a true.

    When I pass in the name of a group that doesn't exist I get the "Forbidden" exception.

    My expectation was that it would pass back false, not throw an exception.

    I can work around it, but I think the behavior is wrong.

    Just my opinion.

    Monday, August 5, 2019 1:09 PM
  • Glad it worked for you Peter. 

    Appreciate you sharing the feedback Peter, will take this to our Product team and see the possibility to articulate the error message more in terms of "Resource Not Found" in this particular instance or anything relevant which can help to better understand the error. Thank you

    Monday, August 5, 2019 7:17 PM
    Owner