How can you detect which edition of Azure AD is in use via C#?
up vote
1
down vote
favorite
I need to determine if the edition of AzureAD in use is Premium or not.
How do I determine that in C#?
azure azure-active-directory microsoft-graph azure-sdk-.net azure-sdk
add a comment |
up vote
1
down vote
favorite
I need to determine if the edition of AzureAD in use is Premium or not.
How do I determine that in C#?
azure azure-active-directory microsoft-graph azure-sdk-.net azure-sdk
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I need to determine if the edition of AzureAD in use is Premium or not.
How do I determine that in C#?
azure azure-active-directory microsoft-graph azure-sdk-.net azure-sdk
I need to determine if the edition of AzureAD in use is Premium or not.
How do I determine that in C#?
azure azure-active-directory microsoft-graph azure-sdk-.net azure-sdk
azure azure-active-directory microsoft-graph azure-sdk-.net azure-sdk
edited Nov 12 at 1:11
Rohit Saigal
2,6322216
2,6322216
asked Nov 10 at 4:51
Dana Epp
57117
57117
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
You can make use of Microsoft Graph APIs, either through Microsoft Graph .NET Client Library or through direct HTTP calls. The relevant API is:
List SubscribedSkus
GET https://graph.microsoft.com/v1.0/subscribedSkus
With Microsoft Graph .NET Client Library and your code could look something like
graphServiceClient.SubscribedSkus
Also, note that for information about edition of Azure AD you could have a mix of services enabled in the same Azure AD and licenses are purchased/assigned on a per user basis.
SubscribedSkus API mentioned above is pretty detailed and it gives you information about enabled capabilities as well as number of licenses available, consumed etc.
Here's a similar thread on MSDN forums, you should also look at, it only talks about portal but still concept is relevant: How to check Azure AD edition.
Here is an example that will print all active subscribed SKUs that include an Azure AD Premium service plan:
// There are various Azure AD versions and editions. Here we're only counting
// Azure AD Premium Plan 1 and Azure AD Premium Plan 2.
var azureAdPlans = new { "AAD_PREMIUM", "AAD_PREMIUM_P2" };
// Get all subscribed SKUs
var subscribedSkus = graphClient
.SubscribedSkus
.Request().GetAsync().GetAwaiter().GetResult();
// Filter down the results to only active subscribed SKUs with Azure AD service plans.
var skusWithAzureAd = subscribedSkus
.Where(sku => (sku.CapabilityStatus == "Enabled" || sku.CapabilityStatus == "Warning")
&& (sku.ServicePlans.Any(p => azureAdPlans.Contains(p.ServicePlanName))));
// Print out the results
foreach (var sku in skusWithAzureAd)
{
Console.WriteLine(
"{0} ({1}/{2} seats used)",
sku.SkuPartNumber,
sku.ConsumedUnits,
sku.PrepaidUnits.Enabled + sku.PrepaidUnits.Warning);
}
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on theServicePlan
property of eachSubscribedSku
object. I've added an edit with an example.
– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236086%2fhow-can-you-detect-which-edition-of-azure-ad-is-in-use-via-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You can make use of Microsoft Graph APIs, either through Microsoft Graph .NET Client Library or through direct HTTP calls. The relevant API is:
List SubscribedSkus
GET https://graph.microsoft.com/v1.0/subscribedSkus
With Microsoft Graph .NET Client Library and your code could look something like
graphServiceClient.SubscribedSkus
Also, note that for information about edition of Azure AD you could have a mix of services enabled in the same Azure AD and licenses are purchased/assigned on a per user basis.
SubscribedSkus API mentioned above is pretty detailed and it gives you information about enabled capabilities as well as number of licenses available, consumed etc.
Here's a similar thread on MSDN forums, you should also look at, it only talks about portal but still concept is relevant: How to check Azure AD edition.
Here is an example that will print all active subscribed SKUs that include an Azure AD Premium service plan:
// There are various Azure AD versions and editions. Here we're only counting
// Azure AD Premium Plan 1 and Azure AD Premium Plan 2.
var azureAdPlans = new { "AAD_PREMIUM", "AAD_PREMIUM_P2" };
// Get all subscribed SKUs
var subscribedSkus = graphClient
.SubscribedSkus
.Request().GetAsync().GetAwaiter().GetResult();
// Filter down the results to only active subscribed SKUs with Azure AD service plans.
var skusWithAzureAd = subscribedSkus
.Where(sku => (sku.CapabilityStatus == "Enabled" || sku.CapabilityStatus == "Warning")
&& (sku.ServicePlans.Any(p => azureAdPlans.Contains(p.ServicePlanName))));
// Print out the results
foreach (var sku in skusWithAzureAd)
{
Console.WriteLine(
"{0} ({1}/{2} seats used)",
sku.SkuPartNumber,
sku.ConsumedUnits,
sku.PrepaidUnits.Enabled + sku.PrepaidUnits.Warning);
}
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on theServicePlan
property of eachSubscribedSku
object. I've added an edit with an example.
– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
add a comment |
up vote
1
down vote
accepted
You can make use of Microsoft Graph APIs, either through Microsoft Graph .NET Client Library or through direct HTTP calls. The relevant API is:
List SubscribedSkus
GET https://graph.microsoft.com/v1.0/subscribedSkus
With Microsoft Graph .NET Client Library and your code could look something like
graphServiceClient.SubscribedSkus
Also, note that for information about edition of Azure AD you could have a mix of services enabled in the same Azure AD and licenses are purchased/assigned on a per user basis.
SubscribedSkus API mentioned above is pretty detailed and it gives you information about enabled capabilities as well as number of licenses available, consumed etc.
Here's a similar thread on MSDN forums, you should also look at, it only talks about portal but still concept is relevant: How to check Azure AD edition.
Here is an example that will print all active subscribed SKUs that include an Azure AD Premium service plan:
// There are various Azure AD versions and editions. Here we're only counting
// Azure AD Premium Plan 1 and Azure AD Premium Plan 2.
var azureAdPlans = new { "AAD_PREMIUM", "AAD_PREMIUM_P2" };
// Get all subscribed SKUs
var subscribedSkus = graphClient
.SubscribedSkus
.Request().GetAsync().GetAwaiter().GetResult();
// Filter down the results to only active subscribed SKUs with Azure AD service plans.
var skusWithAzureAd = subscribedSkus
.Where(sku => (sku.CapabilityStatus == "Enabled" || sku.CapabilityStatus == "Warning")
&& (sku.ServicePlans.Any(p => azureAdPlans.Contains(p.ServicePlanName))));
// Print out the results
foreach (var sku in skusWithAzureAd)
{
Console.WriteLine(
"{0} ({1}/{2} seats used)",
sku.SkuPartNumber,
sku.ConsumedUnits,
sku.PrepaidUnits.Enabled + sku.PrepaidUnits.Warning);
}
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on theServicePlan
property of eachSubscribedSku
object. I've added an edit with an example.
– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You can make use of Microsoft Graph APIs, either through Microsoft Graph .NET Client Library or through direct HTTP calls. The relevant API is:
List SubscribedSkus
GET https://graph.microsoft.com/v1.0/subscribedSkus
With Microsoft Graph .NET Client Library and your code could look something like
graphServiceClient.SubscribedSkus
Also, note that for information about edition of Azure AD you could have a mix of services enabled in the same Azure AD and licenses are purchased/assigned on a per user basis.
SubscribedSkus API mentioned above is pretty detailed and it gives you information about enabled capabilities as well as number of licenses available, consumed etc.
Here's a similar thread on MSDN forums, you should also look at, it only talks about portal but still concept is relevant: How to check Azure AD edition.
Here is an example that will print all active subscribed SKUs that include an Azure AD Premium service plan:
// There are various Azure AD versions and editions. Here we're only counting
// Azure AD Premium Plan 1 and Azure AD Premium Plan 2.
var azureAdPlans = new { "AAD_PREMIUM", "AAD_PREMIUM_P2" };
// Get all subscribed SKUs
var subscribedSkus = graphClient
.SubscribedSkus
.Request().GetAsync().GetAwaiter().GetResult();
// Filter down the results to only active subscribed SKUs with Azure AD service plans.
var skusWithAzureAd = subscribedSkus
.Where(sku => (sku.CapabilityStatus == "Enabled" || sku.CapabilityStatus == "Warning")
&& (sku.ServicePlans.Any(p => azureAdPlans.Contains(p.ServicePlanName))));
// Print out the results
foreach (var sku in skusWithAzureAd)
{
Console.WriteLine(
"{0} ({1}/{2} seats used)",
sku.SkuPartNumber,
sku.ConsumedUnits,
sku.PrepaidUnits.Enabled + sku.PrepaidUnits.Warning);
}
You can make use of Microsoft Graph APIs, either through Microsoft Graph .NET Client Library or through direct HTTP calls. The relevant API is:
List SubscribedSkus
GET https://graph.microsoft.com/v1.0/subscribedSkus
With Microsoft Graph .NET Client Library and your code could look something like
graphServiceClient.SubscribedSkus
Also, note that for information about edition of Azure AD you could have a mix of services enabled in the same Azure AD and licenses are purchased/assigned on a per user basis.
SubscribedSkus API mentioned above is pretty detailed and it gives you information about enabled capabilities as well as number of licenses available, consumed etc.
Here's a similar thread on MSDN forums, you should also look at, it only talks about portal but still concept is relevant: How to check Azure AD edition.
Here is an example that will print all active subscribed SKUs that include an Azure AD Premium service plan:
// There are various Azure AD versions and editions. Here we're only counting
// Azure AD Premium Plan 1 and Azure AD Premium Plan 2.
var azureAdPlans = new { "AAD_PREMIUM", "AAD_PREMIUM_P2" };
// Get all subscribed SKUs
var subscribedSkus = graphClient
.SubscribedSkus
.Request().GetAsync().GetAwaiter().GetResult();
// Filter down the results to only active subscribed SKUs with Azure AD service plans.
var skusWithAzureAd = subscribedSkus
.Where(sku => (sku.CapabilityStatus == "Enabled" || sku.CapabilityStatus == "Warning")
&& (sku.ServicePlans.Any(p => azureAdPlans.Contains(p.ServicePlanName))));
// Print out the results
foreach (var sku in skusWithAzureAd)
{
Console.WriteLine(
"{0} ({1}/{2} seats used)",
sku.SkuPartNumber,
sku.ConsumedUnits,
sku.PrepaidUnits.Enabled + sku.PrepaidUnits.Warning);
}
edited Nov 12 at 14:14
Philippe Signoret
6,40912443
6,40912443
answered Nov 10 at 7:50
Rohit Saigal
2,6322216
2,6322216
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on theServicePlan
property of eachSubscribedSku
object. I've added an edit with an example.
– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
add a comment |
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on theServicePlan
property of eachSubscribedSku
object. I've added an edit with an example.
– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
Thanks. Your link to the other thread brings up an interesting thing. It's possible to have a sku that indirectly gives AAD Premium. How can you detect for that? Check for AAD_PREMIUM or EMS? Is there any other sku to watch for?
– Dana Epp
Nov 10 at 16:04
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp even I'm not sure about all such possible values but I have seen AAD_PREMIUM and also ENTERPRISEPREMIUM
– Rohit Saigal
Nov 12 at 1:05
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on the
ServicePlan
property of each SubscribedSku
object. I've added an edit with an example.– Philippe Signoret
Nov 12 at 14:14
@DanaEpp To get all SKUs which include Azure AD Premium service plans, you can need to filter on the
ServicePlan
property of each SubscribedSku
object. I've added an edit with an example.– Philippe Signoret
Nov 12 at 14:14
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
Thats perfect. Thanks for the insights guys. I found this link useful when trying to figure out what offers AAD_PREMIUM: docs.microsoft.com/en-us/azure/active-directory/…
– Dana Epp
Nov 12 at 16:48
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236086%2fhow-can-you-detect-which-edition-of-azure-ad-is-in-use-via-c%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown