{"id":1248,"date":"2024-07-08T16:37:43","date_gmt":"2024-07-08T14:37:43","guid":{"rendered":"https:\/\/itblogwildi.wordpress.com\/?p=1248"},"modified":"2024-07-08T16:37:43","modified_gmt":"2024-07-08T14:37:43","slug":"m365-microsoft-cloud-lizenz-einer-einzelnen-app-deaktivieren","status":"publish","type":"post","link":"https:\/\/itblog.wildi.dk\/?p=1248","title":{"rendered":"M365 \/ Microsoft Cloud: Lizenz einer einzelnen App deaktivieren"},"content":{"rendered":"\n<p>Wieso einfach, wenn&#8217;s kompliziert geht? Diese Frage stelle ich mir in letzter Zeit immer \u00f6fter, wenn&#8217;s um Microsoft, und insbesondere deren Cloud M365 geht.<\/p>\n\n\n\n<p>Hier ein sch\u00f6nes Beispiel: ich will nur einen Haken einer App entfernen. Im GUI brauche ich dazu nur ein paar Klicks:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2024\/07\/image-1.png?w=724\" alt=\"\" class=\"wp-image-1251\" style=\"width:630px;height:auto\" \/><\/figure>\n\n\n\n<p>Um dasselben mittels Powershell zu l\u00f6sen, ben\u00f6tige ich, sagen wir, ein paar Schritte mehr:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2024\/07\/image-1-2.png?w=1024\" alt=\"\" class=\"wp-image-1253\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>$User = \"user@domain.ch\"\n## Get the services that have already been disabled for the user.\n$userLicense = Get-MgUserLicenseDetail -UserId $User\n$userDisabledPlans = $userLicense.ServicePlans | Where ProvisioningStatus -eq \"Disabled\" | Select -ExpandProperty ServicePlanId\n\n## Get the new service plans that are going to be disabled\n$e5Sku = Get-MgSubscribedSku -All | Where SkuPartNumber -eq 'TEAMS_ESSENTIALS_AAD'\n$newDisabledPlans = $e5Sku.ServicePlans | Where ServicePlanName -in (\"EXCHANGE_S_DESKLESS\") | Select -ExpandProperty ServicePlanId\n\n## Merge the new plans that are to be disabled with the user's current state of disabled plans\n$disabledPlans = ($userDisabledPlans + $newDisabledPlans) | Select -Unique\n\n$addLicenses = @(\n    @{\n        SkuId = $e5Sku.SkuId\n        DisabledPlans = $disabledPlans\n    }\n)\n## Update user's license\nSet-MgUserLicense -UserId $User -AddLicenses $addLicenses -RemoveLicenses @()<\/code><\/pre>\n\n\n\n<p>Naja, nicht sehr effizient, Microsoft :(.<\/p>\n\n\n\n<p>Quelle: <a href=\"https:\/\/learn.microsoft.com\/en-us\/microsoft-365\/enterprise\/disable-access-to-services-with-microsoft-365-powershell?view=o365-worldwide\" target=\"_blank\" rel=\"noopener\">https:\/\/learn.microsoft.com\/en-us\/microsoft-365\/enterprise\/disable-access-to-services-with-microsoft-365-powershell?view=o365-worldwide<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wieso einfach, wenn&#8217;s kompliziert geht? Diese Frage stelle ich mir in letzter Zeit immer \u00f6fter, wenn&#8217;s um Microsoft, und insbesondere&#8230; <a class=\"read-more\" href=\"https:\/\/itblog.wildi.dk\/?p=1248\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1248","post","type-post","status-publish","format-standard","hentry","category-allgemein"],"_links":{"self":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts\/1248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1248"}],"version-history":[{"count":0,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts\/1248\/revisions"}],"wp:attachment":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}