This is just a quick productivity tip when you are developing with multiple tenants in Office365. In my case I have many difference development tenants and our company obviously is using Office365, which adds some of the burden with the movement cross tenants. If you intentionally or by accident save the credentials with the tenants that you use in daily work, you will run into one of the followings when you try to access different tenant.


This is caused due the fact that my login information has been saved with different tenant information and I can’t get to another. Currently we cannot share identities cross multiple tenants, so you’ll have sign out from tenant and re-login for the new one. Due miscellaneous reasons the “click here to sign in with different account to this site” might not work and then you end up in nice loop of trying to get rid of the login information.

There is good Microsoft Knowledge Base article explaining the options, but clearing for example all the cached files does not really seem nice. Alternative for signing out is also to always play with In-private modes or with multiple browsers, which as definitely also valid options, and you can choose the preferred model for you. Clearing the cookies works pretty nicely at least for me.


PowerShell to clear Office365 and Yammer cookies

Here’s a quick helper PowerShell scripts I wrote for clearing my cookies when needed. I actually wrote a separate one for Yammer cookies, but you could combine them pretty easily. These are for Windows 8.1, but they should be looking pretty similar if you are using some other OS in your development lap top.

Clear Office365 cookies from the cookie store

# DELETE Office365 cookies
([system.environment]::GetFolderPath('Cookies')) | Get-ChildItem -recurse | Select-String -pattern "microsoftonline" | group path | ForEach-Object { Remove-Item $ }
([system.environment]::GetFolderPath('Cookies')) | Get-ChildItem -recurse | Select-String -pattern "" | group path | ForEach-Object { Remove-Item $ }

Clear Yammer cookies from the cookie store

 # DELETE YAMMER cookies
([system.environment]::GetFolderPath('Cookies')) | Get-ChildItem -recurse | Select-String -pattern "yammer" | group path | ForEach-Object { Remove-Item $ }


Placing scripts to easily executable location

Depending how often you’d need the scripts, you most likely want to place them to some easily accessible location. In my case I created batch files for the PowerShell execution and added new toolbar to the task bar, so that I can now easily select which script I want to execute directly from the task bar.



PowerShell to the rescue and for automating the authentication cookie clearing. So now whenever I get the authentication issues, I perform following actions:

  1. Close browser
  2. Execute the needed clear cookie batch script
  3. Reopen the browser
    • This could be included to the script as well

That was a quick and small productivity tip based on the questions I’ve got lately related on Office365 development. Hopefully that was useful. If you have good other tips, don’t hesitate to comment and share.