Getting Started - meezankhan9/export-apim-subscriptions-with-users GitHub Wiki

⚙️ Getting Started markdown Copy Edit

Getting Started

To run the script:

  1. Clone the repository:
    git clone https://github.com/meezankhan/azure-apim-product-subscription-export.git
    

Open PowerShell and navigate to the script folder:

powershell Copy Edit cd azure-apim-product-subscription-export Run the script:

powershell Copy Edit .\Get-ApimProductSubscriptions.ps1 A .csv file will be generated in the same folder with detailed product + subscription + user data.

Make sure you have Az modules installed.

perl Copy Edit


🛠 Configuration

# Configuration

Open `Get-ApimProductSubscriptions.ps1` and update the following variables with your environment values:

```powershell
$tenantId           = "<your-tenant-id>"
$appId              = "<client-id of your App Registration>"
$clientSecret       = "<client-secret>"
$subscriptionId     = "<Azure subscription ID>"
$resourceGroupName  = "<APIM resource group>"
$apimServiceName    = "<APIM instance name>"
Azure AD App Registration
Ensure the app registration has:

Azure API Management Service Contributor role on the APIM instance

user_impersonation delegated permission (if used interactively)

yaml
Copy
Edit

---

### 📄 **Output Format**

```markdown
# Output Format

The script exports a `.csv` file with the following columns:

| Column            | Description                              |
|-------------------|------------------------------------------|
| ProductId         | ID of the APIM product                   |
| SubscriptionId    | ID of the subscription                   |
| SubscriptionName  | Display name of the subscription         |
| State             | Status of the subscription (e.g., active)|
| UserName          | Full name of the user                    |
| UserEmail         | Email of the user                        |
| UserId            | Internal user ID                         |
| CreatedDate       | When the subscription was created        |

File name is like:
AllProductSubscriptions_2025-05-26_1540.csv