Updates failing after configuring read only routing for always on availability group

I have setup readonly routing for my always on availability group. I made the change in the connection string to have ApplicationIntent=ReadOnly. The read only queries are getting routed to the secondary and working as expected but the write queries are failing. I am getting error that "Failed to update database <<>> because the database is read-only". The settings for primary and secondary roles are as below

As per msdn article also if the Replica role is Primary, connection access supported on replica is All, connection intent is Read-only, then the query execution should be successful.

Any suggestion on what is wrong in the configuration that is causing the update to fail?

you set database to read only, updation cannot be performed as you have no permission to write