{"id":3898,"date":"2024-09-09T21:07:58","date_gmt":"2024-09-09T13:07:58","guid":{"rendered":"https:\/\/www.rockfu.net\/blog\/?p=3898"},"modified":"2024-09-09T21:08:00","modified_gmt":"2024-09-09T13:08:00","slug":"macos-%e4%b8%8b%e7%9a%84powershell","status":"publish","type":"post","link":"https:\/\/www.rockfu.net\/blog\/2024\/09\/computer\/macos-%e4%b8%8b%e7%9a%84powershell\/","title":{"rendered":"Macos \u4e0b\u7684Powershell"},"content":{"rendered":"\n<p>\u7528Macos\uff0c\u4f46\u662f\u73fe\u5be6\u9003\u96e2\u4e0d\u904eoffice\uff0c\u56e0\u6b64\u9084\u662f\u8981\u90e8\u7f72AD\uff0c\u6c92\u6709PC \u7684\u60c5\u6cc1\u4e0b\u60f3\u7528powershell \u9084\u662f\u7d93\u5e38\u8a66\u904e\uff0c\u6700\u8fd1\u6e2c\u8a66\u4e00\u4e0b\u3002\u9996\u5148\u5fc5\u9808\u6709\u500b\u5229\u5668\uff1abrew <\/p><div class=\"rockf-content\" id=\"rockf-2352475850\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5237544886808594\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-5237544886808594\" \ndata-ad-slot=\"6353985797\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>\n\n\n\n<p>brew \u4f30\u8a08\u7528Macos \u7684\u61c9\u8a72\u719f\u6089\uff0c\u5b89\u88dd\u4e00\u4e9b\u7a0b\u5e8f\u6642\u7d93\u5e38\u6703\u7528\uff0c\u958b\u500b\u7d42\u7aef\uff0c\u8cbc\u4e0a\u53bb\u5c31\u597d\uff0c<a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/scripting\/install\/installing-powershell-on-macos?view=powershell-7.4\" target=\"_blank\" rel=\"noreferrer noopener\">\u8aaa\u660e\u5728\u9019<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)\"<\/code><\/pre>\n\n\n\n<p>\u7d93\u5e38\u8aa4\u6703Azure CLI \u548c Azure AD Powershell\uff0c \u4e4b\u524d\u4e00\u76f4\u7528brew \u5b89\u88ddAzure CLI\uff0c\u7d50\u679c\u8aaa\u6211\u6c92Azure \u670d\u52d9\uff0c\u627e\u4e86\u8cc7\u6599\u767c\u73fe\u539f\u4f86Microsoft 365 \u662f\u7528Azure AD PowerShell\uff0c\u8d70\u4e86\u5f4e\u8def<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>brew install powershell\/tap\/powershell<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u662f\u5b89\u88ddPowershell 7 \uff0c \u5b89\u88dd\u5b8c\u6572\u4e0bpwsh \u7d42\u65bc\u51fa\u73fePowershell \u7248\u672c\uff0cpowershell \u6210\u529f\u57f7\u884c\uff0c\u63a5\u4e0b\u4f86\u53ef\u4ee5\u7e7c\u7e8c\u5b89\u88ddAz Module \u4e86\uff0c\u9084\u662f\u4e0d\u505c\u4e0b\u8f09\u3002<a href=\"https:\/\/learn.microsoft.com\/zh-hk\/powershell\/azure\/install-azps-macos?view=azps-12.2.0\" target=\"_blank\" rel=\"noreferrer noopener\">\u8a73\u7d30\u8aaa\u660e<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module -Name Az -Repository PSGallery -Force<\/code><\/pre>\n\n\n\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u99ac\u4e0a\u9023\u7d50\u6e2c\u8a66\u662f\u5426\u80fd\u9023\u4e0aAD<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Connect-AzAccount\n =<\/code><\/pre>\n\n\n\n<p>\u6210\u529f\u7684\u8a71\uff0c\u8df3\u500b\u7db2\u9801\u51fa\u4f86\uff0c\u767b\u5165\u5e33\u865f\uff0cpowershell \u5c31\u6703\u51fa\u73fe\u7684\u516c\u53f8\u540d\u4e86\u3002<\/p>\n\n\n\n<p>\u63a5\u8457\u8981\u6253\u4ec0\u9ebc\u6307\u4ee4\u5462? \u4e4b\u524d\u6587\u7ae0\u6709\u5beb\u904e\u6279\u91cf\u7684\u66f4\u65b0\u7528\u6236\u8cc7\u6599\uff0c\u53ef\u4ee5\u56de\u9867\u56de\u9867<\/p>\n\n\n\n<p>\u4e0d\u904e\u56e0\u70ba\u6307\u4ee4\u6a21\u7d44\u4e0d\u4e00\u6a23\uff0c\u7528\u6cd5\u4e5f\u6709\u4e0d\u540c\uff0c\u4f8b\u5982\u5217\u51fa10\u7528\u6236<br \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-AzADUser -First 10<\/code><\/pre>\n\n\n\n<p>\u5177\u9ad4\u9084\u662f\u8981\u770b\u8aaa\u660e\uff0c\u96d6\u7136admin panel \u90a3\u908a\u4e5f\u6709\u7db2\u9801\u7d42\u7aef\uff0c\u4e0d\u904e\u6709\u6642\u9084\u662f\u958b\u4e0d\u8d77\u4f86\u3002<\/p>\n\n\n\n<p>\u6a21\u7d44\u5177\u9ad4\u8aaa\u660e<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/az.resources\/get-azaduser?view=azps-12.2.0\">https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/az.resources\/get-azaduser?view=azps-12.2.0<\/a><\/p>\n<div class=\"rockf-after\" id=\"rockf-2524082251\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-5237544886808594\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-5237544886808594\" \ndata-ad-slot=\"6353985797\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u7528Macos\uff0c\u4f46\u662f\u73fe\u5be6\u9003\u96e2\u4e0d\u904eoffice\uff0c\u56e0\u6b64\u9084\u662f\u8981\u90e8\u7f72AD\uff0c\u6c92\u6709PC \u7684\u60c5\u6cc1\u4e0b\u60f3\u7528powershell \u9084 &hellip; <a href=\"https:\/\/www.rockfu.net\/blog\/2024\/09\/computer\/macos-%e4%b8%8b%e7%9a%84powershell\/\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80<span class=\"screen-reader-text\"> &#8220;Macos \u4e0b\u7684Powershell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[84,178],"tags":[],"class_list":["post-3898","post","type-post","status-publish","format-standard","hentry","category-computer","category-mac-book"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prNEE-10S","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/posts\/3898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/comments?post=3898"}],"version-history":[{"count":1,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/posts\/3898\/revisions"}],"predecessor-version":[{"id":3906,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/posts\/3898\/revisions\/3906"}],"wp:attachment":[{"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/media?parent=3898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/categories?post=3898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rockfu.net\/blog\/wp-json\/wp\/v2\/tags?post=3898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}