Microsoft 365: Azure Rights Management hizmetini kullanmak için çevrimiçi hizmetler yapılandırması

Exchange Online, Microsoft SharePoint ve Microsoft OneDrive'ı Azure Information Protection'dan Azure Rights Management hizmetini kullanacak şekilde yapılandırmanıza yardımcı olması için aşağıdaki bölümleri kullanın.

Exchange Online: IRM Yapılandırması

Exchange Online'ın Azure Rights Management hizmetiyle nasıl çalıştığı hakkında bilgi için, Office uygulaması'ler ve hizmetler Azure Rights Management'ı nasıl destekler? bölümündeki Exchange Online ve Exchange Server bölümüne bakın.

Exchange Online, Azure Rights Management hizmetini kullanmak için zaten etkinleştirilmiş olabilir. Denetlemek için aşağıdaki komutları çalıştırın:

  1. Bilgisayarınızda Exchange Online için Windows PowerShell'i ilk kez kullanıyorsanız, Windows PowerShell'i imzalı betikleri çalıştıracak şekilde yapılandırmanız gerekir. Yönetici olarak çalıştır seçeneğini kullanarak Windows PowerShell oturumunuzu başlatın ve şunu yazın:

    Set-ExecutionPolicy RemoteSigned
    

    Onaylamak için Y tuşuna basın.

  2. Windows PowerShell oturumunuzda, uzak Kabuk erişimi için etkinleştirilmiş bir hesap kullanarak Exchange Online'da oturum açın. Varsayılan olarak, Exchange Online'da oluşturulan tüm hesaplar uzaktan Kabuk erişimi için etkinleştirilir, ancak Bu, Set-User <UserIdentity> -RemotePowerShellEnabled komutu kullanılarak devre dışı bırakılabilir (ve etkinleştirilebilir).

    Oturum açmak için önce şunu yazın:

    Connect-ExchangeOnline
    

    Ardından, Windows PowerShell kimlik bilgisi isteği iletişim kutusunda Microsoft 365 kullanıcı adınızı ve parolanızı sağlayın.

  3. Koruma hizmeti için Exchange Online yapılandırmanızı görüntülemek için Get-IRMConfiguration komutunu çalıştırın:

    Get-IRMConfiguration
    

    Çıktıdan AzureRMSLicensingEnabled değerini bulun:

    • AzureRMSLicensingEnabled True olarak ayarlanırsa, Exchange Online Azure Rights Management hizmeti için zaten etkindir.

    • AzureRMSLicensingEnabled False olarak ayarlandıysa, Azure Rights Management hizmeti için Exchange Online'ı etkinleştirmek için aşağıdaki komutu çalıştırın:Set-IRMConfiguration -AzureRMSLicensingEnabled $true

  4. Exchange Online'ın başarıyla yapılandırıldığını test etmek için aşağıdaki komutu çalıştırın:

    Test-IRMConfiguration -Sender <user email address>
    

    Örneğin: Test-IRMConfiguration -Sender adams@contoso.com

    Bu komut, hizmete bağlantıyı doğrulamayı, yapılandırmayı almayı, URI'leri, lisansları ve tüm şablonları almayı içeren bir dizi denetim çalıştırır. Windows PowerShell oturumunda, her şey şu denetimleri geçerse, her birinin sonuçlarını ve sonunda görürsünüz: GENEL SONUÇ: PASS

Exchange Online, Azure Rights Management hizmetini kullanmak üzere etkinleştirildiğinde aşağıdaki özellikleri yapılandırabilirsiniz:

  • Posta akışı kurallarını kullanarak İleti Şifrelemesi'ne bakın.

  • Veri kaybı önleme (DLP) ilkelerini kullanarak şifreleme.

  • Web, Mac, iOS ve Android üzerinde Outlook kullanarak şifreleme ile duyarlılık etiketleri.

  • Postaya ve korumalı sesli posta iletilerine şifreleme ile duyarlılık etiketleri uygulamak için Exchange'de otomatik etiketleme ilkeleri.

Microsoft 365 ve OneDrive'da SharePoint: IRM Yapılandırması

SharePoint IRM'nin Azure Rights Management hizmetiyle nasıl çalıştığı hakkında bilgi için, bu belgelerin Rights Management koruması bölümündeki Microsoft 365'te SharePoint ve SharePoint Server'a bakın.

Microsoft 365 ve OneDrive'da SharePoint'i Azure Rights Management hizmetini destekleyecek şekilde yapılandırmak için önce SharePoint yönetim merkezini kullanarak SharePoint için bilgi hakları yönetimi (IRM) hizmetini etkinleştirmeniz gerekir. Ardından, site sahipleri SharePoint listelerini ve belge kitaplıklarını IRM ile koruyabilir ve kullanıcılar OneDrive kitaplıklarını IRM ile koruyabilir, böylece oraya kaydedilen ve başkalarıyla paylaşılan belgeler Azure Rights Management hizmeti tarafından otomatik olarak korunur.

Not

Microsoft 365 ve OneDrive'da SharePoint için IRM korumalı kitaplıklar, yeni OneDrive eşitleme istemcisinin (OneDrive.exe) en son sürümünü ve Microsoft İndirme Merkezi'nden RMS istemcisinin sürümünü gerektirir. Azure Information Protection istemcisini yüklemiş olsanız bile RMS istemcisinin bu sürümünü yükleyin. Bu dağıtım senaryosu hakkında daha fazla bilgi için bkz. Yeni OneDrive eşitleme istemcisini kurumsal bir ortamda dağıtma.

SharePoint için bilgi hakları yönetimi (IRM) hizmetini etkinleştirmek için Office belgelerinde aşağıdaki yönergelere bakın:

Bu yapılandırma Microsoft 365 yöneticisi tarafından gerçekleştirilir.

Kitaplıklar ve listeler için IRM'yi yapılandırma

SharePoint için IRM hizmetini etkinleştirdikten sonra, site sahipleri SharePoint belge kitaplıklarını ve listelerini IRM ile koruyabilir. Yönergeler için Office web sitesinden aşağıdakilere bakın:

Bu yapılandırma SharePoint site yöneticisi tarafından gerçekleştirilir.

OneDrive için IRM'yi yapılandırma

SharePoint için IRM hizmetini etkinleştirdikten sonra, kullanıcıların OneDrive belge kitaplığı veya tek tek klasörleri Rights Management koruması için yapılandırılabilir. Kullanıcılar, OneDrive web sitelerini kullanarak bunu kendileri için yapılandırabilir. Yöneticiler SharePoint yönetim merkezini kullanarak bu korumayı onlar için yapılandıramaz, ancak bunu Windows PowerShell kullanarak yapabilirsiniz.

Not

OneDrive'ı yapılandırma hakkında daha fazla bilgi için OneDrive belgelerine bakın.

Kullanıcılar için yapılandırma

Kullanıcılara, OneDrive'larını iş dosyalarını koruyacak şekilde yapılandırabilmeleri için aşağıdaki yönergeleri verin.

  1. İş veya okul hesabınızla Microsoft 365'te oturum açın ve OneDrive web sitesine gidin.

  2. Gezinti bölmesinde, alt kısımda Klasik OneDrive'a dön'e tıklayın.

  3. Ayarlar simgesini seçin. Ayarlar bölmesinde Şerit Kapalı olarak ayarlandıysa, şeridi açmak için bu ayarı seçin.

  4. Tüm OneDrive dosyalarını korunacak şekilde yapılandırmak için şeritten KITAPLıK sekmesini ve ardından Kitaplık Ayarlar'ni seçin.

  5. Belgeler Ayarlar sayfasındaki İzinler ve Yönetim bölümünde Bilgi Hakları Yönetimi'ni seçin.>

  6. Bilgi Hakları Yönetimi Ayarlar sayfasında, İndirmede bu kitaplıkta izinleri kısıtla onay kutusunu seçin. İzinler için ad ve açıklama seçiminizi belirtin ve isteğe bağlı olarak, isteğe bağlı yapılandırmaları yapılandırmak için SEÇENEKLERİ GÖSTER'e tıklayın ve ardından Tamam'a tıklayın.

Bu yapılandırma, OneDrive dosyalarını IRM ile korumak için yönetici yerine kullanıcılara bağlı olduğundan, kullanıcıları dosyalarını korumanın avantajları ve bunun nasıl gerçekleştirildiği hakkında eğitin. Örneğin, OneDrive'dan bir belgeyi paylaştıklarında, dosya yeniden adlandırılıp başka bir yere kopyalanmış olsa bile, yalnızca yetkilendirildikleri kişilerin yapılandırdıkları kısıtlamalarla bu belgeye erişebileceğini açıklayın.

Yöneticiler için yapılandırma

SharePoint yönetim merkezini kullanarak kullanıcıların OneDrive'ı için IRM'yi yapılandıramazsınız, ancak bunu Windows PowerShell kullanarak yapabilirsiniz. Bu kitaplıklarda IRM'yi etkinleştirmek için şu adımları izleyin:

  1. SharePoint İstemci Bileşenleri SDK'sını indirin ve yükleyin.

  2. SharePoint Yönetim Kabuğu'nı indirin ve yükleyin.

  3. Aşağıdaki betiğin içeriğini kopyalayın ve dosyayı bilgisayarınızdaki Set-IRMOnOneDriveForBusiness.ps1 olarak adlandırın.

    **Yasal Uyarı**: Bu örnek betik herhangi bir Microsoft standart destek programı veya hizmeti altında desteklenmez. Bu örnek betik, herhangi bir garanti olmadan OLDUĞU GIBI sağlanır.

    # Requires Windows PowerShell version 3
    
    <#
      Description:
    
        Configures IRM policy settings for OneDrive and can also be used for SharePoint libraries and lists
    
     Script Installation Requirements:
    
       SharePoint Client Components SDK
       https://www.microsoft.com/download/details.aspx?id=42038
    
       SharePoint Management Shell
       https://www.microsoft.com/download/details.aspx?id=35588
    
    ======
    #>
    
    # URL will be in the format https://<tenant-name>-admin.sharepoint.com
    $sharepointAdminCenterUrl = "https://contoso-admin.sharepoint.com"
    
    $tenantAdmin = "admin@contoso.com"
    
    $webUrls = @("https://contoso-my.sharepoint.com/personal/user1_contoso_com",
                 "https://contoso-my.sharepoint.com/personal/user2_contoso_com",
                 "https://contoso-my.sharepoint.com/personal/user3_contoso_com")
    
    <# As an alternative to specifying the URLs as an array, you can import them from a CSV file (no header, single value per row).
       Then, use: $webUrls = Get-Content -Path "File_path_and_name.csv"
    
    #>
    
    $listTitle = "Documents"
    
    function Load-SharePointOnlineClientComponentAssemblies
    {
        [cmdletbinding()]
        param()
    
        process
        {
            # assembly location: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
            try
            {
                Write-Verbose "Loading Assembly: Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null
    
                return $true
            }
            catch
            {
                if($_.Exception.Message -match "Could not load file or assembly")
                {
                    Write-Error -Message "Unable to load the SharePoint Server 2013 Client Components.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=42038"
                }
                else
                {
                    Write-Error -Exception $_.Exception
                }
                return $false
            }
        }
    }
    
    function Load-SharePointOnlineModule
    {
        [cmdletbinding()]
        param()
    
        process
        {
            do
            {
                # Installation location: C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell
                $spoModule = Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ErrorAction SilentlyContinue
    
                if(-not $spoModule)
                {
                    try
                    {
                        Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
                        return $true
                    }
                    catch
                    {
                        if($_.Exception.Message -match "Could not load file or assembly")
                        {
                            Write-Error -Message "Unable to load the SharePoint Online Management Shell.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=35588"
                        }
                        else
                        {
                            Write-Error -Exception $_.Exception
                        }
                        return $false
                    }
                }
                else
                {
                    return $true
                }
            }
            while(-not $spoModule)
        }
    }
    
    function Set-IrmConfiguration
    {
        [cmdletbinding()]
        param(
            [parameter(Mandatory=$true)][Microsoft.SharePoint.Client.List]$List,
            [parameter(Mandatory=$true)][string]$PolicyTitle,
            [parameter(Mandatory=$true)][string]$PolicyDescription,
            [parameter(Mandatory=$false)][switch]$IrmReject,
            [parameter(Mandatory=$false)][DateTime]$ProtectionExpirationDate,
            [parameter(Mandatory=$false)][switch]$DisableDocumentBrowserView,
            [parameter(Mandatory=$false)][switch]$AllowPrint,
            [parameter(Mandatory=$false)][switch]$AllowScript,
            [parameter(Mandatory=$false)][switch]$AllowWriteCopy,
            [parameter(Mandatory=$false)][int]$DocumentAccessExpireDays,
            [parameter(Mandatory=$false)][int]$LicenseCacheExpireDays,
            [parameter(Mandatory=$false)][string]$GroupName
        )
    
        process
        {
            Write-Verbose "Applying IRM Configuration on '$($List.Title)'"
    
            # reset the value to the default settings
            $list.InformationRightsManagementSettings.Reset()
    
            $list.IrmEnabled = $true
    
            # IRM Policy title and description
    
                $list.InformationRightsManagementSettings.PolicyTitle       = $PolicyTitle
                $list.InformationRightsManagementSettings.PolicyDescription = $PolicyDescription
    
            # Set additional IRM library settings
    
                # Do not allow users to upload documents that do not support IRM
                $list.IrmReject = $IrmReject.IsPresent
    
                $parsedDate = Get-Date
                if([DateTime]::TryParse($ProtectionExpirationDate, [ref]$parsedDate))
                {
                    # Stop restricting access to the library at <date>
                    $list.IrmExpire = $true
                    $list.InformationRightsManagementSettings.DocumentLibraryProtectionExpireDate = $ProtectionExpirationDate
                }
    
                # Prevent opening documents in the browser for this Document Library
                $list.InformationRightsManagementSettings.DisableDocumentBrowserView = $DisableDocumentBrowserView.IsPresent
    
            # Configure document access rights
    
                # Allow viewers to print
                $list.InformationRightsManagementSettings.AllowPrint = $AllowPrint.IsPresent
    
                # Allow viewers to run script and screen reader to function on downloaded documents
                $list.InformationRightsManagementSettings.AllowScript = $AllowScript.IsPresent
    
                # Allow viewers to write on a copy of the downloaded document
                $list.InformationRightsManagementSettings.AllowWriteCopy = $AllowWriteCopy.IsPresent
    
                if($DocumentAccessExpireDays)
                {
                    # After download, document access rights will expire after these number of days (1-365)
                    $list.InformationRightsManagementSettings.EnableDocumentAccessExpire = $true
                    $list.InformationRightsManagementSettings.DocumentAccessExpireDays   = $DocumentAccessExpireDays
                }
    
            # Set group protection and credentials interval
    
                if($LicenseCacheExpireDays)
                {
                    # Users must verify their credentials using this interval (days)
                    $list.InformationRightsManagementSettings.EnableLicenseCacheExpire = $true
                    $list.InformationRightsManagementSettings.LicenseCacheExpireDays   = $LicenseCacheExpireDays
                }
    
                if($GroupName)
                {
                    # Allow group protection. Default group:
                    $list.InformationRightsManagementSettings.EnableGroupProtection = $true
                    $list.InformationRightsManagementSettings.GroupName             = $GroupName
                }
        }
        end
        {
            if($list)
            {
                Write-Verbose "Committing IRM configuration settings on '$($list.Title)'"
                $list.InformationRightsManagementSettings.Update()
                $list.Update()
                $script:clientContext.Load($list)
                $script:clientContext.ExecuteQuery()
            }
        }
    }
    
    function Get-CredentialFromCredentialCache
    {
        [cmdletbinding()]
        param([string]$CredentialName)
    
        #if( Test-Path variable:\global:CredentialCache )
        if( Get-Variable O365TenantAdminCredentialCache -Scope Global -ErrorAction SilentlyContinue )
        {
            if($global:O365TenantAdminCredentialCache.ContainsKey($CredentialName))
            {
                Write-Verbose "Credential Cache Hit: $CredentialName"
                return $global:O365TenantAdminCredentialCache[$CredentialName]
            }
        }
        Write-Verbose "Credential Cache Miss: $CredentialName"
        return $null
    }
    
    function Add-CredentialToCredentialCache
    {
        [cmdletbinding()]
        param([System.Management.Automation.PSCredential]$Credential)
    
        if(-not (Get-Variable CredentialCache -Scope Global -ErrorAction SilentlyContinue))
        {
            Write-Verbose "Initializing the Credential Cache"
            $global:O365TenantAdminCredentialCache = @{}
        }
    
        Write-Verbose "Adding Credential to the Credential Cache"
        $global:O365TenantAdminCredentialCache[$Credential.UserName] = $Credential
    }
    
    # load the required assemblies and Windows PowerShell modules
    
        if(-not ((Load-SharePointOnlineClientComponentAssemblies) -and (Load-SharePointOnlineModule)) ) { return }
    
    # Add the credentials to the client context and SharePoint service connection
    
        # check for cached credentials to use
        $o365TenantAdminCredential = Get-CredentialFromCredentialCache -CredentialName $tenantAdmin
    
        if(-not $o365TenantAdminCredential)
        {
            # when credentials are not cached, prompt for the tenant admin credentials
            $o365TenantAdminCredential = Get-Credential -UserName $tenantAdmin -Message "Enter the password for the Microsoft 365 admin"
    
            if(-not $o365TenantAdminCredential -or -not $o365TenantAdminCredential.UserName -or $o365TenantAdminCredential.Password.Length -eq 0 )
            {
                Write-Error -Message "Could not validate the supplied tenant admin credentials"
                return
            }
    
            # add the credentials to the cache
            Add-CredentialToCredentialCache -Credential $o365TenantAdminCredential
        }
    
    # connect to Office365 first, required for SharePoint cmdlets to run
    
        Connect-SPOService -Url $sharepointAdminCenterUrl -Credential $o365TenantAdminCredential
    
    # enumerate each of the specified site URLs
    
        foreach($webUrl in $webUrls)
        {
            $grantedSiteCollectionAdmin = $false
    
            try
            {
                # establish the client context and set the credentials to connect to the site
                $script:clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
                $script:clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($o365TenantAdminCredential.UserName, $o365TenantAdminCredential.Password)
    
                # initialize the site and web context
                $script:clientContext.Load($script:clientContext.Site)
                $script:clientContext.Load($script:clientContext.Web)
                $script:clientContext.ExecuteQuery()
    
                # load and ensure the tenant admin user account if present on the target SharePoint site
                $tenantAdminUser = $script:clientContext.Web.EnsureUser($o365TenantAdminCredential.UserName)
                $script:clientContext.Load($tenantAdminUser)
                $script:clientContext.ExecuteQuery()
    
                # check if the tenant admin is a site admin
                if( -not $tenantAdminUser.IsSiteAdmin )
                {
                    try
                    {
                        # grant the tenant admin temporary admin rights to the site collection
                        Set-SPOUser -Site $script:clientContext.Site.Url -LoginName $o365TenantAdminCredential.UserName -IsSiteCollectionAdmin $true | Out-Null
                        $grantedSiteCollectionAdmin = $true
                    }
                    catch
                    {
                        Write-Error $_.Exception
                        return
                    }
                }
    
                try
                {
                    # load the list orlibrary using CSOM
    
                    $list = $null
                    $list = $script:clientContext.Web.Lists.GetByTitle($listTitle)
                    $script:clientContext.Load($list)
                    $script:clientContext.ExecuteQuery()
    
                    # **************  ADMIN INSTRUCTIONS  **************
                    # If necessary, modify the following Set-IrmConfiguration parameters to match your required values
                    # The supplied options and values are for example only
                    # Example that shows the Set-IrmConfiguration command with all parameters: Set-IrmConfiguration -List $list -PolicyTitle "Protected Files" -PolicyDescription "This policy restricts access to authorized users" -IrmReject -ProtectionExpirationDate $(Get-Date).AddDays(180) -DisableDocumentBrowserView -AllowPrint -AllowScript -AllowWriteCopy -LicenseCacheExpireDays 25 -DocumentAccessExpireDays 90
    
                    Set-IrmConfiguration -List $list -PolicyTitle "Protected Files" -PolicyDescription "This policy restricts access to authorized users"  
                }
                catch
                {
                    Write-Error -Message "Error setting IRM configuration on site: $webUrl.`nError Details: $($_.Exception.ToString())"
                }
           }
           finally
           {
                if($grantedSiteCollectionAdmin)
                {
                    # remove the temporary admin rights to the site collection
                    Set-SPOUser -Site $script:clientContext.Site.Url -LoginName $o365TenantAdminCredential.UserName -IsSiteCollectionAdmin $false | Out-Null
                }
           }
        }
    
    Disconnect-SPOService -ErrorAction SilentlyContinue
    
  4. Betiği gözden geçirin ve aşağıdaki değişiklikleri yapın:

    1. Örnek değeri arayın $sharepointAdminCenterUrl ve kendi SharePoint yönetim merkezi URL'nizle değiştirin.

      SharePoint yönetim merkezine gittiğiniz zaman bu değeri temel URL olarak bulursunuz ve şu biçime sahiptir: https://< tenant_name-admin.sharepoint.com>

      Örneğin, kiracı adı "contoso" ise şunları belirtmeniz gerekir: https://contoso-admin.sharepoint.com

    2. Örnek değeri arayın $tenantAdmin ve Microsoft 365 için kendi tam genel yönetici hesabınızla değiştirin.

      Bu değer, genel yönetici olarak Microsoft 365 yönetim merkezi oturum açmak için kullandığınız değerle aynıdır ve şu biçime sahiptir: user_name@<tenant etki alanı adı>.com

      Örneğin, "contoso.com" kiracı etki alanı için Microsoft 365 genel yönetici kullanıcı adı "admin" ise şunları belirtmeniz gerekir: admin@contoso.com

    3. Örnek değerleri arayın $webUrls ve kullanıcılarınızın OneDrive web URL'leriyle değiştirin; ihtiyacınız olan sayıda girdi ekleyin veya silin.

      Alternatif olarak, betikteki bir öğesini içeri aktararak bu diziyi değiştirme hakkındaki açıklamalara bakın. Yapılandırmanız gereken tüm URL'leri içeren CSV dosyası. Bunu doldurmak için URL'leri otomatik olarak aramak ve ayıklamak için başka bir örnek betik sağladık. CSV dosyası. Bunu yapmaya hazır olduğunuzda, tüm OneDrive URL'lerini bir öğesine çıkarmak için Ek betiği kullanın . BU adımlardan hemen sonra CSV dosyası bölümü.

      Kullanıcının OneDrive web URL'si şu biçimdedir: https://< tenant name-my.sharepoint.com/personal/>< user_name>_<tenant name_com>

      Örneğin, contoso kiracısında kullanıcının "rsimone" kullanıcı adı varsa şunları belirtmeniz gerekir: https://contoso-my.sharepoint.com/personal/rsimone_contoso_com

    4. OneDrive'ı yapılandırmak için betiği kullandığımız için değişkenin Belgeler değerini değiştirmeyin $listTitle .

    5. ADMIN INSTRUCTIONS arayın. Bu bölümde değişiklik yapmazsanız, kullanıcının OneDrive'ı IRM için "Korumalı Dosyalar" ilke başlığı ve "Bu ilke yetkili kullanıcılara erişimi kısıtlar" açıklamasıyla yapılandırılır. Büyük olasılıkla çoğu ortam için uygun olan başka bir IRM seçeneği ayarlanamaz. Ancak, önerilen ilke başlığını ve açıklamasını değiştirebilir ve ortamınıza uygun diğer IRM seçeneklerini de ekleyebilirsiniz. Set-IrmConfiguration komutu için kendi parametre kümenizi oluşturmanıza yardımcı olması için betikteki açıklamalı örne bakın.

  5. Betiği kaydedin ve imzalayın. Betiği imzalamazsanız (daha güvenli), bilgisayarınızda Windows PowerShell'in imzasız betikleri çalıştıracak şekilde yapılandırılması gerekir. Bunu yapmak için, Yönetici istrator olarak çalıştır seçeneğiyle bir Windows PowerShell oturumu çalıştırın ve şunu yazın: Set-ExecutionPolicy Unrestricted. Ancak, bu yapılandırma tüm imzasız betiklerin çalıştırılmasını sağlar (daha az güvenli).

    Windows PowerShell betiklerini imzalama hakkında daha fazla bilgi için Bkz . PowerShell belge kitaplığındaki about_Signing .

  6. Betiği çalıştırın ve istenirse Microsoft 365 yönetici hesabının parolasını sağlayın. Betiği değiştirir ve aynı Windows PowerShell oturumunda çalıştırırsanız kimlik bilgileri istenmez.

İpucu

SharePoint kitaplığı için IRM'yi yapılandırmak için de bu betiği kullanabilirsiniz. Bu yapılandırma için, kitaplığın yalnızca korumalı belgeler içerdiğinden emin olmak için Kullanıcıların IRM'yi desteklemeyen belgeleri karşıya yüklemesine izin verme ek seçeneğini etkinleştirmek isteyeceksiniz. Bunu yapmak için parametresini -IrmReject betikteki Set-IrmConfiguration komutuna ekleyin.

Ayrıca değişkenini $webUrls (örneğin, ) ve $listTitle değişkeni (örneğin, https://contoso.sharepoint.com$Reports) değiştirmeniz gerekir.

Kullanıcının OneDrive kitaplıkları için IRM'yi devre dışı bırakmanız gerekiyorsa, OneDrive için IRM'yi devre dışı bırakmak için betik bölümüne bakın.

Tüm OneDrive URL'lerini bir dosyasına çıkarmak için ek betik. CSV dosyası

Yukarıdaki 4c. adım için, aşağıdaki Windows PowerShell betiğini kullanarak tüm kullanıcıların OneDrive kitaplıklarının URL'lerini ayıklayabilirsiniz. Daha sonra bunları denetleyebilir, gerekirse düzenleyebilir ve ardından ana betikte içeri aktarabilirsiniz.

Bu betik ayrıca SharePoint İstemci Bileşenleri SDK'sı ve SharePoint Yönetim Kabuğu gerektirir. Kopyalayıp yapıştırmak için aynı yönergeleri izleyin, dosyayı yerel olarak kaydedin (örneğin, "Report-OneDriveForBusinessSiteInfo.ps1"), ve $tenantAdmin değerlerini daha önce olduğu gibi değiştirin $sharepointAdminCenterUrl ve betiği çalıştırın.

**Yasal Uyarı**: Bu örnek betik herhangi bir Microsoft standart destek programı veya hizmeti altında desteklenmez. Bu örnek betik, herhangi bir garanti olmadan OLDUĞU GIBI sağlanır.

# Requires Windows PowerShell version 3

<#
  Description:

    Queries the search service of a Microsoft 365 tenant to retrieve all OneDrive sites.  
    Details of the discovered sites are written to a .CSV file (by default,"OneDriveForBusinessSiteInfo_<date>.csv").

 Script Installation Requirements:

   SharePoint Client Components SDK
   https://www.microsoft.com/download/details.aspx?id=42038

   SharePoint Management Shell
   https://www.microsoft.com/download/details.aspx?id=35588

======
#>

# URL will be in the format https://<tenant-name>-admin.sharepoint.com
$sharepointAdminCenterUrl = "https://contoso-admin.sharepoint.com"

$tenantAdmin = "admin@contoso.onmicrosoft.com"                           

$reportName = "OneDriveForBusinessSiteInfo_$((Get-Date).ToString("yyyy-MM-dd_hh.mm.ss")).csv"

$oneDriveForBusinessSiteUrls= @()
$resultsProcessed = 0

function Load-SharePointOnlineClientComponentAssemblies
{
    [cmdletbinding()]
    param()

    process
    {
        # assembly location: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
        try
        {
            Write-Verbose "Loading Assembly: Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            return $true
        }
        catch
        {
            if($_.Exception.Message -match "Could not load file or assembly")
            {
                Write-Error -Message "Unable to load the SharePoint Server 2013 Client Components.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=42038"
            }
            else
            {
                Write-Error -Exception $_.Exception
            }
            return $false
        }
    }
}

function Load-SharePointOnlineModule
{
    [cmdletbinding()]
    param()

    process
    {
        do
        {
            # Installation location: C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell
            $spoModule = Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ErrorAction SilentlyContinue

            if(-not $spoModule)
            {
                try
                {
                    Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
                    return $true
                }
                catch
                {
                    if($_.Exception.Message -match "Could not load file or assembly")
                    {
                        Write-Error -Message "Unable to load the SharePoint Online Management Shell.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=35588"
                    }
                    else
                    {
                        Write-Error -Exception $_.Exception
                    }
                    return $false
                }
            }
            else
            {
                return $true
            }
        }
        while(-not $spoModule)
    }
}

function Get-CredentialFromCredentialCache
{
    [cmdletbinding()]
    param([string]$CredentialName)

    #if( Test-Path variable:\global:CredentialCache )
    if( Get-Variable O365TenantAdminCredentialCache -Scope Global -ErrorAction SilentlyContinue )
    {
        if($global:O365TenantAdminCredentialCache.ContainsKey($CredentialName))
        {
            Write-Verbose "Credential Cache Hit: $CredentialName"
            return $global:O365TenantAdminCredentialCache[$CredentialName]
        }
    }
    Write-Verbose "Credential Cache Miss: $CredentialName"
    return $null
}

function Add-CredentialToCredentialCache
{
    [cmdletbinding()]
    param([System.Management.Automation.PSCredential]$Credential)

    if(-not (Get-Variable CredentialCache -Scope Global -ErrorAction SilentlyContinue))
    {
        Write-Verbose "Initializing the Credential Cache"
        $global:O365TenantAdminCredentialCache = @{}
    }

    Write-Verbose "Adding Credential to the Credential Cache"
    $global:O365TenantAdminCredentialCache[$Credential.UserName] = $Credential
}

# load the required assemblies and Windows PowerShell modules

    if(-not ((Load-SharePointOnlineClientComponentAssemblies) -and (Load-SharePointOnlineModule)) ) { return }

# Add the credentials to the client context and SharePoint service connection

    # check for cached credentials to use
    $o365TenantAdminCredential = Get-CredentialFromCredentialCache -CredentialName $tenantAdmin

    if(-not $o365TenantAdminCredential)
    {
        # when credentials are not cached, prompt for the tenant admin credentials
        $o365TenantAdminCredential = Get-Credential -UserName $tenantAdmin -Message "Enter the password for the Office 365 admin"

        if(-not $o365TenantAdminCredential -or -not $o365TenantAdminCredential.UserName -or $o365TenantAdminCredential.Password.Length -eq 0 )
        {
            Write-Error -Message "Could not validate the supplied tenant admin credentials"
            return
        }

        # add the credentials to the cache
        Add-CredentialToCredentialCache -Credential $o365TenantAdminCredential
    }

# establish the client context and set the credentials to connect to the site

    $clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($sharepointAdminCenterUrl)
    $clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($o365TenantAdminCredential.UserName, $o365TenantAdminCredential.Password)

# run a query against the Microsoft 365 tenant search service to retrieve all OneDrive URLs

    do
    {
        # build the query object
	    $query = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($clientContext)
	    $query.TrimDuplicates        = $false
	    $query.RowLimit              = 500
	    $query.QueryText             = "SPSiteUrl:'/personal/' AND contentclass:STS_Site"
	    $query.StartRow              = $resultsProcessed
	    $query.TotalRowsExactMinimum = 500000

        # run the query
	    $searchExecutor = New-Object Microsoft.SharePoint.Client.Search.Query.SearchExecutor($clientContext)
	    $queryResults = $searchExecutor.ExecuteQuery($query)
	    $clientContext.ExecuteQuery()

        # enumerate the search results and store the site URLs
        $queryResults.Value[0].ResultRows | % {
            $oneDriveForBusinessSiteUrls += $_.Path
            $resultsProcessed++
        }
    }
    while($resultsProcessed -lt $queryResults.Value.TotalRows)

$oneDriveForBusinessSiteUrls | Out-File -FilePath $reportName
OneDrive için IRM'yi devre dışı bırakmak için betik

Kullanıcıların OneDrive'ları için IRM'yi devre dışı bırakmanız gerekiyorsa aşağıdaki örnek betiği kullanın.

Bu betik ayrıca SharePoint İstemci Bileşenleri SDK'sı ve SharePoint Yönetim Kabuğu gerektirir. İçeriği kopyalayıp yapıştırın, dosyayı yerel olarak kaydedin (örneğin, "Disable-IRMOnOneDriveForBusiness.ps1") ve ve $tenantAdmin değerlerini değiştirin$sharepointAdminCenterUrl. OneDrive URL'lerini el ile belirtin veya önceki bölümdeki betiği kullanarak bunları içeri aktarabilir ve ardından betiği çalıştırabilirsiniz.

**Yasal Uyarı**: Bu örnek betik herhangi bir Microsoft standart destek programı veya hizmeti altında desteklenmez. Bu örnek betik, herhangi bir garanti olmadan OLDUĞU GIBI sağlanır.

# Requires Windows PowerShell version 3

<#
  Description:

    Disables IRM for OneDrive and can also be used for SharePoint libraries and lists

 Script Installation Requirements:

   SharePoint Client Components SDK
   https://www.microsoft.com/download/details.aspx?id=42038

   SharePoint Management Shell
   https://www.microsoft.com/download/details.aspx?id=35588

======
#>

$sharepointAdminCenterUrl = "https://contoso-admin.sharepoint.com"

$tenantAdmin = "admin@contoso.com"

$webUrls = @("https://contoso-my.sharepoint.com/personal/user1_contoso_com",
             "https://contoso-my.sharepoint.com/personal/user2_contoso_com",
             "https://contoso-my.sharepoint.com/personal/person3_contoso_com")

<# As an alternative to specifying the URLs as an array, you can import them from a CSV file (no header, single value per row).
   Then, use: $webUrls = Get-Content -Path "File_path_and_name.csv"

#>

$listTitle = "Documents"

function Load-SharePointOnlineClientComponentAssemblies
{
    [cmdletbinding()]
    param()

    process
    {
        # assembly location: C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI
        try
        {
            Write-Verbose "Loading Assembly: Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.Office.Client.Policy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.Office.Client.TranslationServices, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.DocumentManagement, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search.Applications, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Search, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            Write-Verbose "Loading Assembly: Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Client.UserProfiles, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | Out-Null

            return $true
        }
        catch
        {
            if($_.Exception.Message -match "Could not load file or assembly")
            {
                Write-Error -Message "Unable to load the SharePoint Server 2013 Client Components.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=42038"
            }
            else
            {
                Write-Error -Exception $_.Exception
            }
            return $false
        }
    }
}

function Load-SharePointOnlineModule
{
    [cmdletbinding()]
    param()

    process
    {
        do
        {
            # Installation location: C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell
            $spoModule = Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ErrorAction SilentlyContinue

            if(-not $spoModule)
            {
                try
                {
                    Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
                    return $true
                }
                catch
                {
                    if($_.Exception.Message -match "Could not load file or assembly")
                    {
                        Write-Error -Message "Unable to load the SharePoint Online Management Shell.`nDownload Location: https://www.microsoft.com/download/details.aspx?id=35588"
                    }
                    else
                    {
                        Write-Error -Exception $_.Exception
                    }
                    return $false
                }
            }
            else
            {
                return $true
            }
        }
        while(-not $spoModule)
    }
}

function Remove-IrmConfiguration
{
    [cmdletbinding()]
    param(
        [parameter(Mandatory=$true)][Microsoft.SharePoint.Client.List]$List
    )

    process
    {
        Write-Verbose "Disabling IRM Configuration on '$($List.Title)'"

        $List.IrmEnabled = $false
        $List.IrmExpire  = $false
        $List.IrmReject  = $false
        $List.InformationRightsManagementSettings.Reset()
    }
    end
    {
        if($List)
        {
            Write-Verbose "Committing IRM configuration settings on '$($list.Title)'"
            $list.InformationRightsManagementSettings.Update()
            $list.Update()
            $script:clientContext.Load($list)
            $script:clientContext.ExecuteQuery()
        }
    }
}

function Get-CredentialFromCredentialCache
{
    [cmdletbinding()]
    param([string]$CredentialName)

    #if( Test-Path variable:\global:CredentialCache )
    if( Get-Variable O365TenantAdminCredentialCache -Scope Global -ErrorAction SilentlyContinue )
    {
        if($global:O365TenantAdminCredentialCache.ContainsKey($CredentialName))
        {
            Write-Verbose "Credential Cache Hit: $CredentialName"
            return $global:O365TenantAdminCredentialCache[$CredentialName]
        }
    }
    Write-Verbose "Credential Cache Miss: $CredentialName"
    return $null
}

function Add-CredentialToCredentialCache
{
    [cmdletbinding()]
    param([System.Management.Automation.PSCredential]$Credential)

    if(-not (Get-Variable CredentialCache -Scope Global -ErrorAction SilentlyContinue))
    {
        Write-Verbose "Initializing the Credential Cache"
        $global:O365TenantAdminCredentialCache = @{}
    }

    Write-Verbose "Adding Credential to the Credential Cache"
    $global:O365TenantAdminCredentialCache[$Credential.UserName] = $Credential
}

# load the required assemblies and Windows PowerShell modules

    if(-not ((Load-SharePointOnlineClientComponentAssemblies) -and (Load-SharePointOnlineModule)) ) { return }

# Add the credentials to the client context and SharePoint service connection

    # check for cached credentials to use
    $o365TenantAdminCredential = Get-CredentialFromCredentialCache -CredentialName $tenantAdmin

    if(-not $o365TenantAdminCredential)
    {
        # when credentials are not cached, prompt for the tenant admin credentials
        $o365TenantAdminCredential = Get-Credential -UserName $tenantAdmin -Message "Enter the password for the Office 365 admin"

        if(-not $o365TenantAdminCredential -or -not $o365TenantAdminCredential.UserName -or $o365TenantAdminCredential.Password.Length -eq 0 )
        {
            Write-Error -Message "Could not validate the supplied tenant admin credentials"
            return
        }

        # add the credentials to the cache
        Add-CredentialToCredentialCache -Credential $o365TenantAdminCredential
    }

# connect to Office365 first, required for SharePoint cmdlets to run

    Connect-SPOService -Url $sharepointAdminCenterUrl -Credential $o365TenantAdminCredential

# enumerate each of the specified site URLs

    foreach($webUrl in $webUrls)
    {
        $grantedSiteCollectionAdmin = $false

        try
        {
            # establish the client context and set the credentials to connect to the site
            $script:clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
            $script:clientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($o365TenantAdminCredential.UserName, $o365TenantAdminCredential.Password)

            # initialize the site and web context
            $script:clientContext.Load($script:clientContext.Site)
            $script:clientContext.Load($script:clientContext.Web)
            $script:clientContext.ExecuteQuery()

            # load and ensure the tenant admin user account if present on the target SharePoint site
            $tenantAdminUser = $script:clientContext.Web.EnsureUser($o365TenantAdminCredential.UserName)
            $script:clientContext.Load($tenantAdminUser)
            $script:clientContext.ExecuteQuery()

            # check if the tenant admin is a site admin
            if( -not $tenantAdminUser.IsSiteAdmin )
            {
                try
                {
                    # grant the tenant admin temporary admin rights to the site collection
                    Set-SPOUser -Site $script:clientContext.Site.Url -LoginName $o365TenantAdminCredential.UserName -IsSiteCollectionAdmin $true | Out-Null
                    $grantedSiteCollectionAdmin = $true
                }
                catch
                {
                    Write-Error $_.Exception
                    return
                }
            }

            try
            {
                # load the list orlibrary using CSOM

                $list = $null
                $list = $script:clientContext.Web.Lists.GetByTitle($listTitle)
                $script:clientContext.Load($list)
                $script:clientContext.ExecuteQuery()

               Remove-IrmConfiguration -List $list
            }
            catch
            {
                Write-Error -Message "Error setting IRM configuration on site: $webUrl.`nError Details: $($_.Exception.ToString())"
            }
       }
       finally
       {
            if($grantedSiteCollectionAdmin)
            {
                # remove the temporary admin rights to the site collection
                Set-SPOUser -Site $script:clientContext.Site.Url -LoginName $o365TenantAdminCredential.UserName -IsSiteCollectionAdmin $false | Out-Null
            }
       }
    }

Disconnect-SPOService -ErrorAction SilentlyContinue