diff --git a/README.md b/README.md index 9f925bb43daa..015f0f32728a 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,41 @@ Management libraries can be identified by namespaces that start with `azure-mgmt * File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-python/issues) * Check [previous questions](https://stackoverflow.com/questions/tagged/azure+python) or ask new ones on StackOverflow using `azure` and `python` tags. + +## Data Collection +The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described below. You can learn more about data collection and use in the help documentation and Microsoft’s [privacy statement](https://go.microsoft.com/fwlink/?LinkID=824704). For more information on the data collected by the Azure SDK, please visit the [Telemetry Guidelines](https://azure.github.io/azure-sdk/general_azurecore.html#telemetry-policy) page. + +### Telemetry Configuration +Telemetry collection is on by default. + +To opt out, you can disable telemetry at client construction. Define a `NoUserAgentPolicy` class that is a subclass of `UserAgentPolicy` with an `on_request` method that does nothing. Then pass instance of this class as kwargs `user_agent_policy=NoUserAgentPolicy()` during client creation. This will disable telemetry for all methods in the client. Do this for every new client. + +The example below uses the `azure-storage-blob` package. In your code, you can replace `azure-storage-blob` with the package you are using. + +```python +import os +from azure.identity import ManagedIdentityCredential +from azure.storage.blob import BlobServiceClient +from azure.core.pipeline.policies import UserAgentPolicy + + +# Create your credential you want to use +mi_credential = ManagedIdentityCredential() + +account_url = "https://.blob.core.windows.net" + +# Set up user-agent override +class NoUserAgentPolicy(UserAgentPolicy): + def on_request(self, request): + pass + +# Create the BlobServiceClient object +blob_service_client = BlobServiceClient(account_url, credential=mi_credential, user_agent_policy=NoUserAgentPolicy()) + +container_client = blob_service_client.get_container_client(container=) +# TODO: do something with the container client like download blob to a file +``` + ### Reporting security issues and security bugs Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) . You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the [Security TechCenter](https://www.microsoft.com/msrc/faqs-report-an-issue).