Mandatory Anonymous Link Expiration is a new feature for SharePoint Online and OneDrive for Business. This feature started rolling out January 12th, 2016, and is scheduled to complete in the coming weeks.
With this feature, administrators can now set a mandatory expiration length for all anonymous links created in their company to help promote security and link hygiene. End users will be required to create links that match or are shorter than the stated expiration value.
There is no default value for anonymous link expiration. To begin using this feature, use the SharePoint Online Management Shell using the “RequireAnonymousLinksExpireInDays” parameter.
As an example, this will set expiry for 30 days:
Set-SPOTenant –RequireAnonymousLinksExpireInDays 30
This feature strikes the balance between productivity and security, allowing users to easily share content, while preventing shared content from endlessly being shared with potentially unauthorized people (for example, after a person leaves an organization, if they had a copy of an anonymous link, at least those can now expire).