When a user is deleted from Azure Active Directory, their Sways enter into a holding state where they will get deleted later. During that period of time, the Sway won't be accessible to regular users. IT administrators have 30 days after a user is permanently deleted from the Azure Active Directory to reassign Sways that they owned to another user within their tenant.
Note: The Azure Active Directory also has a holding period before the user is permanently deleted.
Step 1: Download and install libraries
Important: PowerShell cmdlets were updated with security enhancements in December 2022. Ensure that you always use the latest libraries referred below. If you have an older version of the library already installed on your local machine, ensure that you delete the older libraries, associated folders, then restart your machine before proceeding with the following instructions.
-
Ensure that the user who is running the cmdlet is a Global Administrator.
-
Download PowerShell 7 x64 here.
Important: When using the installation widget do not change any of the options.
-
Download the latest libraries here.
-
Extract the libraries:
-
Microsoft.Identity.Client
-
Microsoft.Office.Story.PowerShell.ChangeOwnerClient
-
Microsoft.Office.Story.PowerShell.Protocol
-
Newtonsoft.Json
-
-
Keep the folder structure intact and install them as modules using, follow the instruction here.
For example:
Copy and install modules to ...\Windows\system32\WindowsPowerShell\v1.0\Modules\ -
Ensure that the downloaded .dll files are not blocked by unblocking them via their properties settings.
Example:
Important: Make sure downloaded files are unblocked by selecting Unblock in the Properties settings.
Step 2: Import the Modules in PowerShell
-
Open PowerShell 7 (x64) as an administrator:
The Windows PowerShell window will pop open. The prompt C:\Windows\system32 means you've opened it as an administrator.
2. Import the modules that were previously downloaded.
Syntax:
Import-Module Microsoft.Identity.Client
Import-Module Newtonsoft.Json
Import-Module Microsoft.Office.Story.PowerShell.Protocol
Import-Module Microsoft.Office.Story.PowerShell.ChangeOwnerClient
Step 3 - Connect to the Sway Service and run the transfer script
Note: Sways can only be transferred from the owner to another user within the same tenant. Only the tenant administrator may initiate a transfer.
-
Connect to the Sway Service via PowerShell
-
Enter the credentials of the tenant administrator
Syntax:
Connect-SwayService
Example:
Connect-SwayService
Transfer a single Sway to another account
To transfer a single Sway that was previously owned by a deleted account to another account within the same tenant, you will need the following information:
-
Sway Lookup ID - ID found after the sway.office.com URL for any given Sway (e.g. "Ex: abc123 for https://sway.office.com/abc123")
-
New Email Address - email address of the account you are transferring the Sway to
Syntax:
Start-ChangeSwayOwner -OriginalSwayLookupId <Sway Lookup ID> -DestinationOwner <New Email Address>
Example:
Start-ChangeSwayOwner -OriginalSwayLookupId abc123 -DestinationOwner user@contoso.com
Note: Do not use the entire URL of the Sway as the Lookup ID. In the above example, "abc123" is the Lookup ID and NOT "https://sway.office.com/abc123"
Bulk transfer all Sways from one account to another
To transfer all Sways previously owned by a deleted account to another account within the same tenant, you will need the following information:
-
Deleted Account Email Address - email address of the account that was deleted from the Azure Active Directory
-
New Account Email Address - email address of the account you are transferring the Sway to
Syntax:
Start-BulkChangeSwayOwner <Deleted Account Email Address> <New Account Email Address>
Example:
Start-BulkChangeSwayOwner deleteduser@contoso.com activeuser@contoso.com
Step 4 - Verify that the Sways were reassigned
-
Go to a Sway that was reassigned.
-
Notify the user who the Sways were transferred to and ask them to verify that they now own the Sways.
Things to Know
-
You have up to 30 days of the account being permanently deleted from the Azure Active Directory to reassign any Sways that were owned by that account
-
After successfully running the reassignment script, it could take up to 1 hour for the reassigned Sways to appear in the new account.
-
Some settings associated with the reassigned Sway won't be preserved. This includes:
-
Sway Analytics
-
Share settings
-
If a Sway was shared with specific people, it will be reset back to the default settings in the reassigned Sway
-
For Sways that were shared for editing, the new owner will need to re-share a new link to any coauthors who still need edit access
-
-
Last edited date
-
Settings previously set on the Sway. For example: removal of the Sway banner and Autoplay.
-
When videos are uploaded they're copied asynchronously and may be subject to data loss if the transfer is performed very close to the 30-day limit.
-
The library was designed to run on PowerShell 5.1. If you're running a newer version, you need to import the modules in compatibility mode. Follow the instructions in the following topic: Windows PowerShell Compatibility.
-