Customers are continuing to expand their footprint in Azure and there is a significant need to understand resource usage, optimize it as far as possible and plan for future growth. Microsoft Peek is a one stop PaaS based solution which allows us to abstract the intricacies of collecting the usage data for different use cases (Cloud Solution Provider, Direct, and Enterprise Agreement Azure subscriptions) and provides detailed visuals for near real time data analytics.
The following are required prerequisites for this sample project
Prerequisite | Purpose |
---|---|
Azure Subscription | A subscription is required to host the Azure WebJob and provide the Azure Storage account. |
Usage information for direct Azure subscriptions is obtained using the Azure RateCard and Azure Usage APIs. To access both of these APIs an application must be registered within the Azure AD tenant that has access to the subscriptions. Perform the following in order to create and configure the required application
-
Login into https://portal.azure.com using credentials that have Global Admin privileges
-
Open the Azure Active Directory management experience
-
Click on App registrations and then click Add to create a new application
-
Specify the appropriate information within the Create blade and then click Create
-
Click Required permissions on the Settings blade and then click Add
-
Select the Windows Azure Service Management API and select the Access Azure Service Management as organization users (preview) permissions and then click Done
-
Click on Keys on the Settings blade and then click Add
Microsoft provides the Partner Center API to enable a partner to interact with various aspects of the Cloud Solution Provider program. To access the Partner Center API an application must be registered and configured with the partner's Azure AD tenant. Perform the following tasks to create and configure the application.
-
Login into https://partnercenter.microsoft.com using credentials that have both AdminAgent and Global Admin privileges
-
Click Dashboard -> Account Settings -> App Management
-
Click on Register existing app if you want to use an existing Azure AD application, or click Add new web app to create a new one
-
Document the App ID and Account ID values. Also, if necessary create a key and document that value.
It is important to understand that the creation and configuration of this Azure AD application can be done from the Azure Management portal. However, since this application utilizes app only authentication to access the Partner Center API the application must be registred in Partner Center using this process. Otherwise, you will receive a HTTP 401 error with every attempt to access the Partner Center API.
Perform the following steps to configure the application that will be used to access the Partner Center API for pre-consent
- Install Azure AD PowerShell Module (instruction available here).
- Update the AppId and DisplayName variables in the PowerShell script below
- Execute the modified PowerShell script. When prompted for authentication specify credentials that belong to the tenant where the application was created and that have global admin privileges
Connect-AzureAD
$AppId = 'INSERT-APPLICATION-ID-HERE'
$DisplayName = 'INSERT-APPLICATION-DISPLAY-NAME-HERE'
$g = Get-AzureADGroup | ? {$_.DisplayName -eq 'AdminAgents'}
$s = Get-AzureADServicePrincipal | ? {$_.AppId -eq $AppId}
if ($s -eq $null) { $s = New-AzureADServicePrincipal -AppId $AppId -DisplayName $DisplayName }
Add-AzureADGroupMember -ObjectId $g.ObjectId -RefObjectId $s.ObjectId
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.