"You cannot convert the specified domain to use identity federation because the account you are currently signed in with is a member of the domain. Please sign in to the service using an account that is a member of the company administrators."
This threw me at first but it was because I had authenticated to Office 365 using a Global Administrator account that was configured with my public domain suffix (edin-networks.com) in this example. The fix was to create a new Global Administrator user that was set to use the .onmicrosoft domain suffix.
Ensure the Global Administrator role is assigned to the user account.
Create your PowerShell connection and the Convert-MsolDomainToFederated command should work correctly.