我无法导入 powershell 模块 Microsoft.Graph.Entra.Beta。 我想使用 Set-EntraBetaTrustFrameworkPolicy 模块按照此 Microsoft 文档将 xml 配置上传到 Azure AD B2C:https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.entra.beta/set -entrabetatrustframeworkpolicy?view=entra-powershell-beta 。并且需要安装 Microsoft.Graph.Entra.Beta 模块。
我使用此命令来安装模块:
Install-Module -Name Microsoft.Graph.Entra.Beta -Scope CurrentUser -Force -AllowClobber
这是我在 github 操作中看到的错误:
found in any module directory.
At D:\a\_temp\360a07d2-14b9-4abd-8843-bc54622430e9.ps1:22 char:1
+ Import-Module Microsoft.Graph.Entra.Beta
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (Microsoft.Graph.Entra.Beta:String) [Import-Module], FileNotFoundEx
ception
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand```
[1]: https://learn.microsoft.com/en-us/powershell/module/microsoft.graph.entra.beta/set-entrabetatrustframeworkpolicy?view=entra-powershell-beta
要安装并导入
Microsoft.Graph.Entra.Beta
,请使用以下 yml
文件:
name: Azure AD B2C Policy Upload
on:
push:
branches:
- main
jobs:
install-and-upload:
runs-on: windows-latest # Use a Windows runner
steps:
- name: Checkout code
uses: actions/checkout@v3 # Checkout your repository code to access the PowerShell script
- name: Install Microsoft.Graph.Entra.Beta module
shell: pwsh
run: |
Install-Module -Name Microsoft.Graph.Entra.Beta -AllowPrerelease -Force -Scope CurrentUser
- name: Import the module
shell: pwsh
run: |
Import-Module Microsoft.Graph.Entra.Beta
- name: Connect the module
shell: pwsh
run: |
Connect-Entra
模块安装并导入成功如下:
如果 PowerShell 连接存在任何问题,通常会出现错误“在任何模块目录中找不到”。利用 shell: pwsh
yml
文件来安装和导入模块。