{"id":6206,"date":"2020-08-04T13:01:22","date_gmt":"2020-08-04T13:01:22","guid":{"rendered":"https:\/\/www.softreetechnology.com\/?p=6206"},"modified":"2020-08-04T13:01:22","modified_gmt":"2020-08-04T13:01:22","slug":"retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell","status":"publish","type":"post","link":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/","title":{"rendered":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell"},"content":{"rendered":"\n<p>In this article, I have included a whole load of blog examples on how to\nconnect to your Office 365 account and retrieve account details like license\nname, service plan, licensed users, and external users. You have to follow\nbelow instructions for better results.<strong><\/strong><\/p>\n\n\n\n<p>\u2022 Connect to AzureAD<br>\u2022 PowerShell code<\/p>\n\n\n\n<p><span style=\"text-decoration: underline;\"><strong>Connect to AzureAD :<\/strong><\/span><\/p>\n\n\n\n<p>1. Run Windows PowerShell as an administrator.<\/p>\n\n\n\n<p>2. In that command window, run &#8220;<strong>Install-Module -Name AzureAD<\/strong>&#8221;\nto install the AzureAD, if it is not installed on your end. If it shows a\nmessage about installing a module from an untrusted repository, then type\n&#8220;Y&#8221; and press Enter button.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/1.png\" alt=\"\" class=\"wp-image-6207\" width=\"602\" height=\"315\"\/><\/figure>\n\n\n\n<p>3. Then run the command &#8220;<strong>Connect-AzureAD<\/strong>&#8220;. It will prompt to\nsign in to your Microsoft account. Type your Office 365 account user name and\npassword and click Next.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/2.png\" alt=\"\" class=\"wp-image-6208\" width=\"502\" height=\"395\"\/><\/figure>\n\n\n\n<p>4. Then run the command &#8220;<strong>Install-Module MSOnline<\/strong>&#8221; to install MSOnline on your end. If it prompts to install the NuGet provider, type \u2018<strong>Y\u2019<\/strong>. If it prompts to install the module from PSGallery, type \u2018<strong>Y\u2019<\/strong> and press ENTER.<\/p>\n\n\n\n<p>5. Run the &#8220;<strong>Connect-MsolService&#8221; <\/strong>command and then provide\nyour credentials and click on next.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/3.png\" alt=\"\" class=\"wp-image-6209\" width=\"586\" height=\"379\"\/><\/figure>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">PowerShell Code :<\/span><\/strong><\/p>\n\n\n\n<p>The below code retrieves the details of license name, licensed users,\nexternal users, and services plan of your Office365 Account.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> $credential = Get-Credential\nConnect-MsolService -Credential $credential \ntry{\n\n  #Retrieve license list present inside tenant\n  $license = Get-MsolAccountSku\n  for($i = 0; $i -lt $license.Count; $i++) \n     {\n           $nameLicense = $licenseLists[$i]\n\n           #Retrieve License Name\n           Write-Host \"License Name =\"$nameLicense.SkuPartNumber\n\n           #Retrieve assigned users count\n           Write-Host \"Assigned Users =\" $nameLicense.ConsumedUnits  \n      }\n\n   $extUserCount = Get-MsolAccountSku | Where-Object {$_UserPrincipalName -like \"*#EXT#*\"} \n   Write-Host \"External User = \" $extUserCount.Count\n\n   #Show the service status of Tenant\n   Get-MsolAccountSku | Select -ExpandProperty ServiceStatus\n         \n   sleep 10\n     \n}catch{} <\/code><\/pre>\n\n\n\n<p>The out-put will be\nlike the below image.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/4.png\" alt=\"\" class=\"wp-image-6210\" width=\"263\" height=\"396\"\/><\/figure>\n\n\n\n<p><span style=\"text-decoration: underline;\"><em><strong>Keywords:<\/strong><\/em><\/span><br> \u2022 Get license and users details Using PowerShell Azure Active Directory. <br> \u2022 Retrieve license name and assigned users by Connecting Azure Active Directory.<br> \u2022 Retrieve all account license and service details in Office 365 using Azure Active Directory PowerShell.<br> \u2022 Get service plan and license details of Office 365 Using MsolService.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I have included a whole load of blog examples on how to connect to your Office 365 account and retrieve account details like license name, service plan, licensed users, and external users. You have to follow below instructions for better results. \u2022 Connect to AzureAD\u2022 PowerShell code Connect to AzureAD : 1. Run Windows PowerShell as an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[127],"tags":[],"class_list":["post-6206","post","type-post","status-publish","format-standard","hentry","category-office-365"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell - Softree Technology<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell - Softree Technology\" \/>\n<meta property=\"og:description\" content=\"In this article, I have included a whole load of blog examples on how to connect to your Office 365 account and retrieve account details like license name, service plan, licensed users, and external users. You have to follow below instructions for better results. \u2022 Connect to AzureAD\u2022 PowerShell code Connect to AzureAD : 1. Run Windows PowerShell as an [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Softree Technology\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-04T13:01:22+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell - Softree Technology","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell - Softree Technology","og_description":"In this article, I have included a whole load of blog examples on how to connect to your Office 365 account and retrieve account details like license name, service plan, licensed users, and external users. You have to follow below instructions for better results. \u2022 Connect to AzureAD\u2022 PowerShell code Connect to AzureAD : 1. Run Windows PowerShell as an [&hellip;]","og_url":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/","og_site_name":"Softree Technology","article_published_time":"2020-08-04T13:01:22+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#article","isPartOf":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/"},"author":{"name":"admin","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/98740297642f06debccdcee2de84086b"},"headline":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell","datePublished":"2020-08-04T13:01:22+00:00","mainEntityOfPage":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/"},"wordCount":262,"commentCount":0,"publisher":{"@id":"https:\/\/softreetechnology.com\/blog\/#organization"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/1.png","articleSection":["Office 365"],"inLanguage":"en","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/","url":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/","name":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell - Softree Technology","isPartOf":{"@id":"https:\/\/softreetechnology.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#primaryimage"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/1.png","datePublished":"2020-08-04T13:01:22+00:00","breadcrumb":{"@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#primaryimage","url":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/1.png","contentUrl":"https:\/\/www.softreetechnology.com\/wp-content\/uploads\/2020\/08\/1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/softreetechnology.com\/blog\/office-365\/retrieve-all-account-license-and-service-details-in-office-365-using-azure-active-directory-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/softreetechnology.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Retrieve All Account License And Service Details In Office 365 Using Azure Active Directory PowerShell"}]},{"@type":"WebSite","@id":"https:\/\/softreetechnology.com\/blog\/#website","url":"https:\/\/softreetechnology.com\/blog\/","name":"Softree Technology","description":"Celebrating 10+ Years in SharePoint Consulting !","publisher":{"@id":"https:\/\/softreetechnology.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/softreetechnology.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/softreetechnology.com\/blog\/#organization","name":"Softree Technology","url":"https:\/\/softreetechnology.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/softreetechnology.com\/blog\/wp-content\/uploads\/2023\/03\/cropped-white-logo-soft.png","contentUrl":"https:\/\/softreetechnology.com\/blog\/wp-content\/uploads\/2023\/03\/cropped-white-logo-soft.png","width":844,"height":230,"caption":"Softree Technology"},"image":{"@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/98740297642f06debccdcee2de84086b","name":"admin","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/softreetechnology.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6fc78c8a7aa3fb0bf43c3b9a2e3962d7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6fc78c8a7aa3fb0bf43c3b9a2e3962d7?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/softreeconsulting.com"],"url":"https:\/\/softreetechnology.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts\/6206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/comments?post=6206"}],"version-history":[{"count":0,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/posts\/6206\/revisions"}],"wp:attachment":[{"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/media?parent=6206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/categories?post=6206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softreetechnology.com\/blog\/wp-json\/wp\/v2\/tags?post=6206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}