Skip to content

How to set customized user agent?

Kan Tang edited this page Jun 18, 2019 · 1 revision

If you want to customize the user-agent HTTP header, you can specify with the below code.

azure::storage::operation_context context;
context.user_headers().add(
    web::http::header_names::user_agent, 
    utility::string_t(_XPLATSTR("CUSTOMIZED_USER_AGENT/")).append(azure::storage::protocol::header_value_user_agent)
);

Note that please make sure azure::storage::protocol::header_value_user_agent is added, this is to ensure the telemetry data we gathered from the service end is correct and can be used for priority and scheduling purposes.