다음을 통해 공유


라이센스 수락이 필요한 모듈

개요

일부 모듈 게시자의 법무 부서에서는 고객이 PowerShell 갤러리에서 모듈을 설치하기 전에 라이선스에 명시적으로 동의해야 합니다. 사용자가 PowerShellGet을 사용하여 직접 또는 다른 패키지에 대한 종속성으로 모듈을 설치, 업데이트 또는 저장하고 해당 모듈에 사용자가 라이선스에 동의해야 하는 경우 사용자는 라이선스에 동의하거나 작업이 실패함을 표시해야 합니다.

모듈에 대한 게시 요구 사항

사용자에게 라이선스에 동의하도록 요구하려는 모듈은 다음 요구 사항을 충족해야 합니다.

  • 모듈 매니페스트의 PSData 섹션에는 RequireLicenseAcceptance = $True가 포함되어야 합니다.
  • 모듈에는 루트 디렉토리에 license.txt 파일이 포함되어야 합니다.
  • 모듈 매니페스트에는 라이선스 URI가 포함되어야 합니다.
  • 모듈은 PowerShellGet 형식 버전 2.0 이상으로 게시해야 합니다.

설치/저장/Update-Module에 미치는 영향

  • 설치/저장/업데이트 cmdlet은 사용자가 라이선스를 본 것처럼 동작하는 새 매개 변수 AcceptLicense 를 지원합니다.
  • RequiredLicenseAcceptance가 True이고 AcceptLicense가 지정되지 않은 경우 사용자에게 가 표시license.txt되고 메시지가 표시됩니다. Do you accept these license terms (Yes/No/YesToAll/NoToAll)
    • 라이센스가 수락된 경우
      • Save-Module: 모듈이 사용자 시스템에 복사됩니다.
      • Install-Module: 모듈이 사용자 시스템의 적절한 폴더(범위 기반)에 복사됩니다.
      • Update-Module: 모듈이 업데이트됩니다.
    • 라이센스가 거부된 경우.
      • 작업이 취소됩니다.
      • 모든 cmdlet은 라이선스 동의가 필요하다는 메타데이터(requireLicenseAcceptance 및 Format Version)를 확인합니다
      • 클라이언트의 형식 버전이 2.0보다 오래된 경우 작업이 실패하고 사용자에게 클라이언트 업데이트를 요청합니다.
      • 모듈이 2.0 이전 형식 버전으로 게시된 경우 requireLicenseAcceptance 플래그는 무시됩니다.

모듈 종속성

  • 설치/저장/업데이트 작업 중에 종속 모듈(모듈에 따라 다른 항목)에 라이센스 동의가 필요한 경우 라이센스 동의 동작(위)이 필요합니다.
  • 모듈 버전이 시스템에 설치된 것으로 로컬 카탈로그에 이미 나열되어 있는 경우 라이센스 검사를 무시합니다.
  • 설치/저장/업데이트 작업 중에 종속 모듈에 라이센스가 필요하고 라이센스 수락이 발생하지 않으면 작업이 실패하고 패키지가 설치/저장/업데이트에 실패한 것에 대한 정상적인 프로세스를 따릅니다.

-Force에 미치는 영향

지정하는 것 –Force 만으로는 라이센스를 수락하기에 충분하지 않습니다. –AcceptLicense 설치 권한에 필요합니다. –Force 지정되면 RequiredLicenseAcceptance가 True –AcceptLicense 이고 지정되지 않으면 작업이 실패합니다.

예제

예제 1: 라이선스 동의를 요구하도록 모듈 매니페스트 업데이트

Update-ModuleManifest -Path C:\modulemanifest.psd1 -RequireLicenseAcceptance -PrivateData @{
    PSData = @{
        # Flag to indicate whether the module requires explicit user acceptance
        RequireLicenseAcceptance = $true
    } # End of PSData hashtable

 } # End of PrivateData hashtable

이 명령은 매니페스트 파일을 업데이트하고 RequireLicenseAcceptance 플래그를 true로 설정합니다.

예제 2: 라이센스 동의가 필요한 모듈 설치

Install-Module -Name ModuleRequireLicenseAcceptance
License Acceptance

License 2.0
Copyright (c) 2016 PowerShell Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

Do you accept the license terms for module 'ModuleRequireLicenseAcceptance'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

이 명령은 파일의 라이센스 license.txt 를 표시하고 사용자에게 라이센스에 동의하라는 메시지를 표시합니다.

예제 3: -AcceptLicense를 사용하여 라이센스 수락이 필요한 모듈 설치

Install-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

라이센스 수락 프롬프트 없이 모듈이 설치됩니다.

예제 4: -Force를 사용하여 라이센스 수락이 필요한 모듈 설치

Install-Module -Name ModuleRequireLicenseAcceptance -Force
PackageManagement\Install-Package : License Acceptance is required for module 'ModuleRequireLicenseAcceptance'. Please specify '-AcceptLicense' to perform this operation.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.1.3.3\PSModule.psm1:1837 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], E
   xception
    + FullyQualifiedErrorId : ForceAcceptLicense,Install-PackageUtility,Microsoft.PowerShell.PackageManagement.Cmdlets
   .InstallPackage

예제 5: 라이센스 동의가 필요한 종속성이 있는 모듈 설치

모듈 ModuleWithDependency모듈 ModuleRequireLicenseAcceptance에 따라 달라집니다. 사용자에게 라이센스를 수락하라는 메시지가 표시됩니다.

Install-Module -Name ModuleWithDependency
License Acceptance
MIT License 2.0
Copyright (c) 2016 PowerShell Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

Do you accept the license terms for module 'ModuleRequireLicenseAcceptance'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

예제 6: 라이센스 수락 및 -AcceptLicense이 필요한 종속성이 있는 모듈 설치

모듈 ModuleWithDependency모듈 ModuleRequireLicenseAcceptance에 따라 달라집니다. AcceptLicense가 지정되었으므로 사용자에게 라이센스를 수락하라는 메시지가 표시되지 않습니다.

Install-Module -Name ModuleWithDependency -AcceptLicense

예제 7: PSGetFormatVersion 2.0 이전 클라이언트에서 라이선스 수락이 필요한 모듈 설치

Install-Module -Name ModuleRequireLicenseAcceptance
WARNING: The specified module 'ModuleRequireLicenseAcceptance' with PowerShellGetFormatVersion
'2.0' is not supported by the current version of PowerShellGet. Get the latest version of the
PowerShellGet module to install this module, 'ModuleRequireLicenseAcceptance'.

예 8: 라이센스 동의가 필요한 저장 모듈

Save-Module -Name ModuleRequireLicenseAcceptance -Path C:\Saved
License Acceptance

License 2.0
Copyright (c) 2016 PowerShell Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

Do you accept the license terms for module 'ModuleRequireLicenseAcceptance'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

이 명령은 파일의 라이센스 license.txt 를 표시하고 사용자에게 라이센스에 동의하라는 메시지를 표시합니다.

예 9: -AcceptLicense를 사용하여 라이센스 수락이 필요한 저장 모듈

Save-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense -Path C:\Saved

라이센스 수락 프롬프트 없이 모듈이 저장됩니다.

예제 10: 라이센스 동의가 필요한 업데이트 모듈

Update-Module -Name ModuleRequireLicenseAcceptance
License Acceptance

License 2.0
Copyright (c) 2016 PowerShell Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

Do you accept the license terms for module 'ModuleRequireLicenseAcceptance'.
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

이 명령은 파일의 라이센스 license.txt 를 표시하고 사용자에게 라이센스에 동의하라는 메시지를 표시합니다.

예 11: -AcceptLicense를 사용하여 라이센스 수락이 필요한 업데이트 모듈

Update-Module -Name ModuleRequireLicenseAcceptance -AcceptLicense

라이센스 수락 프롬프트 없이 모듈이 업데이트됩니다.

자세한 정보

스크립트에 대한 라이센스 동의 필요

PowerShellGallery에서 라이선스 수락 지원 필요

Azure Automation에 배포할 때 라이선스 수락 필요