Forum Discussion

dakdgdl's avatar
dakdgdl
Helper I
1 year ago
Solved

PowerBI Custom Visual - Licensing API - Doesn't return an attribute indicating the Service Plan Name

Hello Guys,   Our custome visual is now published in the Microsoft AppSource with 3 different plans as below. Core, Pro and Enterprise.   When we call the Licensing API as below page guides, it ...
  • jaineshp's avatar
    1 year ago

    Hey dakdgdl,

    Yeah, the Licensing API only gives you spIdentifier and state - no friendly plan names. Pretty frustrating!

     

    https://learn.microsoft.com/en-us/power-bi/developer/visuals/licensing-api

     

    What I Did

    1. Map Your Plan IDs Go to Partner Center → Your Offer → Plan Overview. Copy those Service IDs and create a simple mapping:

     

    const planNames = {
    "abc123-core-id": "Core",
    "def456-pro-id": "Pro",
    "ghi789-enterprise-id": "Enterprise"
    };

     

    2. Simple Plan Detection Function

     

    function getUserPlan(servicePlans) {
    const activePlans = servicePlans.filter(p =>
    p.state === "Active" || p.state === "Warning"
    );

    for (let plan of activePlans) {
    if (planNames[plan.spIdentifier]) {
    return planNames[plan.spIdentifier];
    }
    }
    return "No License";
    }

     

    3. Use It in Your License Check

     

    this.licenseManager.getAvailableServicePlans()
    .then(result => {
    if (result.isLicenseInfoAvailable && result.plans) {
    const userPlan = getUserPlan(result.plans);
    // Now you know if it's Core, Pro, or Enterprise!
    this.enableFeaturesFor(userPlan);
    }
    });

     

    Pro Tips from Experience

    • Cache the license info - don't call the API repeatedly
    • Handle multiple active licenses (user might have upgraded)
    • Always check for "Warning" state too (grace period)
    • Test with different license scenarios

    Why This Works

    Microsoft intentionally doesn't expose plan names for security. The spIdentifier is your unique key - you just need to maintain the mapping yourself.

     

    Fixed? ✓ Mark it • Share it • Help others!


    Best Regards,
    Jainesh Poojara | Power BI Developer

     

     

     

     

  • dakdgdl's avatar
    dakdgdl
    1 year ago

    Thanks...

    As you saying each spIdentifier is a unique string based on the version/subscription.

    So that it make sense..