Only set realm if resource realm is not already set.