我试图用azure powershell docker基本映像构建自己的自定义docker映像。作为一项附加功能,我需要添加Microsoft Graph模块(特别是https://www.powershellgallery.com/packages/Microsoft.Graph.Identity.SignIns/1.10.0)中的docker图像。以下是我为实现它而编写的一些代码。
Dockerfile
FROM mcr.microsoft.com/powershell:ubuntu-22.04
RUN pwsh -Command Set-PSRepository -Name PSGallery -InstallationPolicy Trusted &&
pwsh -Command Install-Module -Name Microsoft.Graph.Identity.SignIns -Scope AllUsers -Repository PSGallery &&
pwsh -Command Set-PSRepository -Name PSGallery -InstallationPolicy Untrusted
ADD deployment/powershell/Main.ps1 Main.ps1
CMD ["pwsh", "-File", "Main.ps1"]
Main.ps1
Update-MgPolicyB2CAuthenticationMethodPolicy
模块路径:
错误
Line |
32 | Update-MgPolicyB2CAuthenticationMethodPolicy
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The term 'Update-MgPolicyB2CAuthenticationMethodPolicy' is not
| recognized as a name of a cmdlet, function, script file, or
| executable program. Check the spelling of the name, or if a
| path was included, verify that the path is correct and try
| again.
信息powershell版本:7.2.5
查找模块日志
Name : Microsoft.Graph.Identity.SignIns
Path : /usr/local/share/powershell/Modules/Microsoft.Graph.Identit
y.SignIns/1.10.0/Microsoft.Graph.Identity.SignIns.psd1
Description : Microsoft Graph PowerShell Cmdlets
Guid : 60f889fa-f873-43ad-b7d3-b7fc1273a44f
Version : 1.10.0
ModuleBase : /usr/local/share/powershell/Modules/Microsoft.Graph.Identit
y.SignIns/1.10.0
ModuleType : Script
PrivateData : {PSData, Profiles}
AccessMode : ReadWrite
ExportedAliases : {}
ExportedCmdlets : {}
ExportedFunctions : {[Confirm-MgInformationProtectionSignature,
Confirm-MgInformationProtectionSignature],
[Confirm-MgRiskyServicePrincipalCompromised,
Confirm-MgRiskyServicePrincipalCompromised],
[Confirm-MgRiskyUserCompromised,
Confirm-MgRiskyUserCompromised],
[Get-MgDataPolicyOperation, Get-MgDataPolicyOperation]…}
ExportedVariables : {}
NestedModules : {}
问题根据Microsoft.Graph.Identity.SignIns,存在许多函数,其中一些函数运行良好,有些与上面不同。文档中没有给出折旧信息。造成部分负荷的主要原因是什么?
在此处输入图像描述
这些命令在MS图形powershell测试版中可用。所以您需要安装Microsoft.Graph.Beta cmdlet-https://github.com/microsoftgraph/msgraph-sdk-powershell/tree/master