Running your function in portal requires the app to explicitly accept requests from https://portal.azure.com. This is known as cross-origin resource sharing (CORS). Configure CORS to add https://portal.azure.com to allowed origins.
The other reasons you might not be able to run the function app is due to network restrictions.