1

Sorry for asking a very lame question here. The API sample code is very much descriptive no doubt. But the build fails for me everytime i run it. the error says "error CS1029: #error: 'Please update the appSettings section in app.config, then remove this statement'"

So the question here is what details go here:

<add key="ADALRedirectURL" value="https://localhost/"/>
<add key="TenantDomain" value="ENTER.AZURE.AD.DNS.NAME"/>                           
<add key="SubscriptionID" value="00000000-0000-0000-0000-000000000000"/>
<add key="ClientId" value="00000000-0000-0000-0000-000000000000"/>

ADALRedirectURL= ive mentioned the same "//localhost/"

Tenantdomain= ive entered default directory domain like xyzqwerty1234@onmicrosoft.com

SubscriptionID= got it from login-azurermaccount

ClientID= from the Directory page.

please suggest if i have entered the values incorrect or what :( BTW my subscription is an MicrosoftPartnerNetwork Subscription I hope thats not a problem.

Thanks in advance.

RZKjr
  • 11
  • 1

2 Answers2

0

If you are using the demo on https://github.com/Azure-Samples/billing-dotnet-usage-api That have the instruction how to use it here https://github.com/Azure-Samples/billing-dotnet-usage-api/blob/master/README.md

To configure a new AAD application:

  1. Sign in to the Azure portal, using credentials that have been granted service administrator/co-administrator access on the subscription which is trusting your AAD tenant, and granted Global Administrator access in the AAD tenant. See Manage Accounts, Subscriptions, and Administrative Roles for details on managing the service administrator and co-administrators.
  2. Select the AAD tenant you wish to use, and go to the "Applications" page.
  3. From there, you can use the "Add" feature to "Add a new application my organization is developing".
  4. Provide a name (ie: ConsoleApp-Billing-Usage or similar) for the new application.
  5. Be sure to select the "Native Client Application" type, then specify a valid URL for "Redirect URI" (which can be https://localhost/ for the purposes of this sample), and click the check mark to save.
  6. After you've added the new application, select it again within the list of applications and click "Configure" so you can make sure the sample app will have permissions to access the Windows Azure Service Management APIs, which is the permission used to secure the Billing APIs.
  7. Scroll down to the to the "Permissions to other applications" section of your newly created application's configuration page. Then click the "Add Application" button, select the "Windows Azure Service Management" row, and click the check mark to save. After saving, hover the "Delegated Permissions" area on the right side of the "Windows Azure Service Management" row, click the "Delegated Permissions" drop down list, select the "Access Azure Service Management (preview)" option, and click "Save" again.

    NOTE: the "Windows Azure Active Directory" permission "Enable sign-on and read users' profiles" is enabled by default. It allows users to sign in to the application with their organizational accounts, enabling the application to read the profiles of signed-in users, such as their email address and contact information. This is a delegation permission, and gives the user the ability to consent before proceeding. Please refer to Adding, Updating, and Removing an Application for more depth on configuring an Azure AD tenant to enable an application to access your tenant.

  8. While you are on this page, also note/copy the "Client ID" GUID and "Redirect URI", as you will use these in Step #3 below. You will also need your Azure Subscription ID and AAD tenant domain name, both of which you can copy from the "Settings" page in the management portal.

0

For the Tenant Domain, use the Directory name of your account. To find your Azure Subscription ID and AAD tenant domain name in the current version of the Azure portal: Navigate to Cost Managment + Billing, and select Overview. The TenantDomain is listed as the Directory, and should have the format "yourdomain.onmicrosoft.com". The ClientId is the Application Id you saved in the final task of Step #1, above.

Once you have updated the app.config file, delete or comment-out the #error line in Program.cs.

Note that the instructions at https://github.com/Azure-Samples/billing-dotnet-ratecard-api/ are outdated. They should now be:

To configure a new AAD application:

  1. Sign in to the Azure portal (http://manage.windowsazure.com), using credentials that have been granted service administrator/co-administrator access on the subscription which is trusting your AAD tenant, and granted Global Administrator access in the AAD tenant. See Manage Accounts, Subscriptions, and Administrative Roles for details on managing the service administrator and co-administrators.
  2. Navigate to Azure Active Directory and select "App registrations" and then select "Enterprise applications."
  3. Click the "New application" button and then select "Application you're developing".
  4. Click the link to "OK, take me to App Registrations to register my new application."
  5. Click "New application registration."
  6. Provide a name (ie: ConsoleApp-Billing-RateCard or similar) for the new application.
  7. Be sure to select the "Native Client Application" type, then specify a valid URL for "Redirect URI" (which can be http://localhost/ for the purposes of this sample). Save this URI for use in Step #3 below.
  8. Click in whitespace on the Create panel to let the URI field-validation complete, and click the Create button.
  9. After you've added the new application, select it again within the list of applications and click "Settings" so you can make sure the sample app will have permissions to access the Windows Azure Service Management APIs, which is the permission used to secure the Billing APIs.
  10. Select "Required permissions".
  11. Click the "Add" button, and then "Select an API" and then select "Windows Azure Service Management API" and click the "Select" button.
  12. On the Enable Access panel that appears, select the "Access Azure Service Management as organization users (preview)" option, and click "Select" again. Click the "Done" button.

    NOTE: the "Windows Azure Active Directory" permission "Sign in and read user profile" is enabled by default. It allows users to sign in to the application with their organizational accounts, enabling the application to read the profiles of signed-in users, such as their email address and contact information. This is a delegation permission, and gives the user the ability to consent before proceeding. Please refer to Adding, Updating, and Removing an Application for more depth on configuring an Azure AD tenant to enable an application to access your tenant.

  13. Close the "Required permissions" and "Settings" panels.

  14. On the Registered app panel for your application, note/copy the "Application ID" GUID, as you will use it in Step #3 below.

I am working on trying to get this submitted to the Azure github...

Groot
  • 1
  • 1