Support adding custom policies
See original GitHub issueIs your feature request related to a problem? Please describe.
I am trying to work around https://github.com/Azure/azure-sdk-for-python/issues/8313 by adding a new custom policy called ExternalBearerTokenCredentialPolicy, but I find it difficult.
The only way to change the default policy list is to override the whole list by passing policies in ARMPipelineClient’s kwargs:
When ARMPipelineClient is created without policies argument, it builds the default policy list from config=self._config:
In order to add a custom policy to the default policy list, I must also manually create all policies created by NetworkManagementClientConfiguration:
This apparently seems too complicated.
Describe the solution you’d like
SDKs should expose the ability to add custom policies to the default policy list.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
“first” and “last” does not have to mean “literally first or last in the pipeline”. “Last” can be synonymous with “do-this-for-each-try” and the first can be “do-this-once”. The names can be improved.
One (more complicated) alternative is to give policies “well known names” and have an “insert before/after” or “replace” method for it. But that is probably more power than most people would need.
Fixed.