661
Дана задача, выгрузить список пользователей из Azure через powershell в формате CSV , которым назначена лицензия E1 и E3 .
Содержание
Поключаемся к Azure
Install-Module MSOnline -Force
Connect-MsolService
Получить список подписок в Azure
PS C:\Windows\system32> Get-AzureADSubscribedSku
ObjectId SkuPartNumber PrepaidUnits
-------- ------------- ------------
a0f24a76-ea0c-4195-9216-c0eaeab5b122_c5928f49-12ba-48f7-ada3-0d743a3601d5 VISIOCLIENT class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_1f2f344a-700d-42c9-9427-5cea1d5d7ba6 STREAM class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_f8a1db68-be16-40ed-86d5-cb42ce701560 POWER_BI_PRO class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_8f0c5670-4e56-4892-b06d-91c085d7004f SPZA_IW class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_b3a42176-0a8c-4c3f-ba4e-f2b37fe5be6b FLOW_BUSINESS_PROCESS class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_6470687e-a428-4b7a-bef2-8a291ad947c9 WINDOWS_STORE class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_6fd2c87f-b296-42f0-b197-1e91e994b900 ENTERPRISEPACK class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_776df282-9fc0-4862-99e2-70e561b9909e PROJECTESSENTIALS class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_f30db892-07e9-47e9-837c-80727f46fd3d FLOW_FREE class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_606b54a9-78d8-4298-ad8b-df6ef4481c80 CCIBOTS_PRIVPREV_VIRAL class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_dcb1a3ae-b33f-4487-846a-a640262fadf4 POWERAPPS_VIRAL class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_a403ebcc-fae0-4ca2-8c8c-7a907fd6c235 POWER_BI_STANDARD class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_c2273bd0-dff7-4215-9ef5-2c7bcfb06425 OFFICESUBSCRIPTION class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_efccb6f7-5641-4e0e-bd10-b4976e1bf68e EMS class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_078d2b04-f1bd-4111-bbd4-b4b1b354cef4 AAD_PREMIUM class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_093e8d14-a334-43d9-93e3-30589a8b47d0 RMSBASIC class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_4b244418-9658-4451-a2b8-b5e2b364e9bd VISIOONLINE_PLAN1 class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_53818b1b-4a27-454b-8896-0dba576410e6 PROJECTPROFESSIONAL class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_a8ad7d2b-b8cf-49d6-b25a-69094a0be206 POWERAPPS_PER_APP class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_16a55f2f-ff35-4cd5-9146-fb784e3761a5 DEFENDER_ENDPOINT_P1 class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_8c4ce438-32a7-4ac5-91a6-e22ae08d9c8b RIGHTSMANAGEMENT_ADHOC class LicenseUnitsDetail {...
a0f24a76-ea0c-4195-9216-c0eaeab5b122_18181a46-0d4e-45cd-891e-60aabd171b4e STANDARDPACK class LicenseUnitsDetail {...
Получить список подписок с счетчиком лицензий
PS C:\Windows\system32> Get-AzureADSubscribedSku | Select -Property Sku*,ConsumedUnits -ExpandProperty PrepaidUnits
SkuId : c5928f49-12ba-48f7-ada3-0d743a3601d5
SkuPartNumber : VISIOCLIENT
ConsumedUnits : 0
Enabled : 61
Suspended : 0
Warning : 0
SkuId : 1f2f344a-700d-42c9-9427-5cea1d5d7ba6
SkuPartNumber : STREAM
ConsumedUnits : 741
Enabled : 1000000
Suspended : 0
Warning : 0
SkuId : f8a1db68-be16-40ed-86d5-cb42ce701560
SkuPartNumber : POWER_BI_PRO
ConsumedUnits : 34
Enabled : 50
Suspended : 0
Warning : 0
SkuId : 8f0c5670-4e56-4892-b06d-91c085d7004f
SkuPartNumber : SPZA_IW
ConsumedUnits : 0
Enabled : 10000
Suspended : 0
Warning : 0
SkuId : b3a42176-0a8c-4c3f-ba4e-f2b37fe5be6b
SkuPartNumber : FLOW_BUSINESS_PROCESS
ConsumedUnits : 0
Enabled : 30
Suspended : 0
Warning : 0
SkuId : 6470687e-a428-4b7a-bef2-8a291ad947c9
SkuPartNumber : WINDOWS_STORE
ConsumedUnits : 0
Enabled : 1000000
Suspended : 0
Warning : 0
SkuId : 6fd2c87f-b296-42f0-b197-1e91e994b900
SkuPartNumber : ENTERPRISEPACK
ConsumedUnits : 1437
Enabled : 1438
Suspended : 0
Warning : 0
SkuId : 776df282-9fc0-4862-99e2-70e561b9909e
SkuPartNumber : PROJECTESSENTIALS
ConsumedUnits : 0
Enabled : 150
Suspended : 0
Warning : 0
SkuId : f30db892-07e9-47e9-837c-80727f46fd3d
SkuPartNumber : FLOW_FREE
ConsumedUnits : 1612
Enabled : 10000
Suspended : 0
Warning : 0
SkuId : 606b54a9-78d8-4298-ad8b-df6ef4481c80
SkuPartNumber : CCIBOTS_PRIVPREV_VIRAL
ConsumedUnits : 0
Enabled : 10000
Suspended : 0
Warning : 0
SkuId : dcb1a3ae-b33f-4487-846a-a640262fadf4
SkuPartNumber : POWERAPPS_VIRAL
ConsumedUnits : 11
Enabled : 10000
Suspended : 0
Warning : 0
SkuId : a403ebcc-fae0-4ca2-8c8c-7a907fd6c235
SkuPartNumber : POWER_BI_STANDARD
ConsumedUnits : 3
Enabled : 1000000
Suspended : 0
Warning : 0
SkuId : c2273bd0-dff7-4215-9ef5-2c7bcfb06425
SkuPartNumber : OFFICESUBSCRIPTION
ConsumedUnits : 2
Enabled : 2156
Suspended : 0
Warning : 0
SkuId : efccb6f7-5641-4e0e-bd10-b4976e1bf68e
SkuPartNumber : EMS
ConsumedUnits : 2
Enabled : 1465
Suspended : 0
Warning : 0
SkuId : 078d2b04-f1bd-4111-bbd4-b4b1b354cef4
SkuPartNumber : AAD_PREMIUM
ConsumedUnits : 0
Enabled : 700
Suspended : 0
Warning : 0
SkuId : 093e8d14-a334-43d9-93e3-30589a8b47d0
SkuPartNumber : RMSBASIC
ConsumedUnits : 0
Enabled : 1
Suspended : 0
Warning : 0
SkuId : 4b244418-9658-4451-a2b8-b5e2b364e9bd
SkuPartNumber : VISIOONLINE_PLAN1
ConsumedUnits : 0
Enabled : 74
Suspended : 0
Warning : 0
SkuId : 53818b1b-4a27-454b-8896-0dba576410e6
SkuPartNumber : PROJECTPROFESSIONAL
ConsumedUnits : 1
Enabled : 99
Suspended : 0
Warning : 0
SkuId : a8ad7d2b-b8cf-49d6-b25a-69094a0be206
SkuPartNumber : POWERAPPS_PER_APP
ConsumedUnits : 0
Enabled : 100
Suspended : 0
Warning : 0
SkuId : 16a55f2f-ff35-4cd5-9146-fb784e3761a5
SkuPartNumber : DEFENDER_ENDPOINT_P1
ConsumedUnits : 0
Enabled : 1465
Suspended : 0
Warning : 0
SkuId : 8c4ce438-32a7-4ac5-91a6-e22ae08d9c8b
SkuPartNumber : RIGHTSMANAGEMENT_ADHOC
ConsumedUnits : 5
Enabled : 50000
Suspended : 0
Warning : 0
SkuId : 18181a46-0d4e-45cd-891e-60aabd171b4e
SkuPartNumber : STANDARDPACK
ConsumedUnits : 1501
Enabled : 1500
Suspended : 0
Warning : 0
В SkuPartNumber указано название лицензии (лицензионного плана). В Enabled – количество лицензий, приобретенных в рамках данного плана. ConsumedUnits – количество лицензий, назначенных пользователям.
Также по ссылке можно посмтреть все skuid именования продуктов
Задача получить юзеров STANDARDPACK (E1 лицензии) и ENTERPRISEPACK (E3 лицензии)
Команда для получения списка пользователей с лицензией E1 из Azure
Get-MSOLUser -all | Where-Object {($_.licenses).AccountSkuId -match "STANDARDPACK"} | Select LastPasswordChangeTimestamp,DisplayName,UserPrincipalName, @{e={$_.ProxyAddresses -cmatch '^SMTP\:.*'};name='Primaryaddress'} | Export-CSV "C:\temp\E1.CSV" -NoTypeInformation -Encoding UTF8
Команда для получения списка пользователей с лицензией E3 из Azure
Get-MSOLUser -all | Where-Object {($_.licenses).AccountSkuId -match "ENTERPRISEPACK"} | Select LastPasswordChangeTimestamp,DisplayName,UserPrincipalName, @{e={$_.ProxyAddresses -cmatch '^SMTP\:.*'};name='Primaryaddress'} | Export-CSV "C:\temp\E3.CSV" -NoTypeInformation -Encoding UTF8
На этом все.