Test your App Fabric ACS v2 RPS Application to use actual REALM and Return URL in Cloud and localhost URL in Compute Emulator

Today while I was testing my web role which includes Google Identity Provider with Windows Azure AppFabric ACSv2 locally in compute emulator I found after google IP authentication the return URL is my actual web role running in cloud.


My expectation was to use my https://localhost as REALM/return URL when I test same application in compute emulator and when I deploy it to Windows Azure, it should use actual https://my_service_name.cloudapp.net URL.


My App Fabric ACS v2 based Relying Party Application setting were as below:


Because of above settings, in compute emulator, after Google authentication was complete actual return URL was launched.


I wanted to use https://LocalHost when I was testing my application in compute emulator so changing Realm and Return URL in RPS was not a good option because I also want to keep my real *.cloudapp.net URL.


To solve this problem, I looked my ASP.NET web role application web.config and manually change the realm and return URL values to use http:\\Localhost:XXXX\ and after I just restarted the same instance again in Compute Emulator and after Google IP authentication the local return URL was used.