title: How to manage customer's usage-based subscription programmatically?
body: <p>Let me first describe a "manual" scenario. I login to Partner Center as a partner and go to customer list (<a href="https://partnercenter.microsoft.com/en-us/pcv/customers/list" rel="nofollow noreferrer">https://partnercenter.microsoft.com/en-us/pcv/customers/list</a>). For any customer it is possible to manage all its usage-based subscriptions in Azure portal using <code>All resources (Azure portal)</code> link: </p>
  
  <p><a href="https://i.stack.imgur.com/vYZtd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vYZtd.png" alt="enter image description here"></a></p>
  
  <p>In particular, I can add a co-admin to subscription (i.e. add a user with role <code>Owner</code>): </p>
  
  <p><a href="https://i.stack.imgur.com/TXKP0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TXKP0.png" alt="enter image description here"></a></p>
  
  <p>How to automate this management of customer's subscriptions? </p>
  
  <p>My efforts: I have some experience of CREST API and <a href="https://azure.microsoft.com/en-us/documentation/articles/role-based-access-control-manage-access-rest/" rel="nofollow noreferrer">RBAC API</a>. This is  limitation of an Azure Active Directory (AAD) application described in <a href="https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/" rel="nofollow noreferrer">docs</a>: </p>
  
  <blockquote>
    <p>You can only grant access to resource in your subscription for applications in the <strong>same</strong> directory as your subscription.</p>
  </blockquote>
  
  <p>Due to each customer's subscription exists in separate customer's AAD, it seems RBAC API cann't help:</p>
  
  <ol>
  <li><p>It requires an AAD application-based token (i.e. based on <code>TenantId</code>,
  <code>ClientId</code>, <code>ClientSecret</code>), and there is no way to
  programmatically create an AAD application in <strong>customer</strong>'s directory.</p></li>
  <li><p>An application located in <strong>partner</strong>'s AAD cann't get access to
  <strong>customer</strong>'s subscription.</p></li>
  </ol>
  
  <p>Does any way to programmatically add an admin/co-admin/owner to customer's subscription exist?</p>