Repository: PrefectHQ/prefect

Issue:
Azure result handlers are not compatible with environment variable settings
## Description
*A clear description of the bug*

(As reported in Slack)


```
storage = Azure(container="prefect-flows")
with Flow("Hello World from Azure!", storage=storage) as flow:
    simple_task_test()
flow.register()
```

```
AZURE_STORAGE_CONNECTION_STRING=XXXXXX 
prefect agent start
```

Because the Azure result handler has a default secret name, [this condition](https://github.com/PrefectHQ/prefect/blob/master/src/prefect/engine/result_handlers/azure_result_handler.py#L58) is always met and so the result handler doesn't respect the environment variable.

## Expected Behavior
*What did you expect to happen instead?*

The connection string provided in the environment variable should be used instead of the default Secret name.

For now, a workaround is to manually overwrite the default secret name:
```
flow.result_handler.azure_credentials_secret=None
```


## Reproduction
*A minimal example that exhibits the behavior.*




## Environment
*Any additional information about your environment*

*Optionally run `prefect diagnostics` from the command line and paste the information here*



Discussion:

Resolving patch:
diff --git a/src/prefect/engine/result_handlers/azure_result_handler.py b/src/prefect/engine/result_handlers/azure_result_handler.py
--- a/src/prefect/engine/result_handlers/azure_result_handler.py
+++ b/src/prefect/engine/result_handlers/azure_result_handler.py
@@ -55,7 +55,9 @@ def initialize_service(self) -> None:
         import azure.storage.blob
 
         kwargs = dict()
-        if self.azure_credentials_secret:
+        if self.connection_string:
+            kwargs["connection_string"] = self.connection_string
+        else:
             azure_credentials = Secret(self.azure_credentials_secret).get()
             if isinstance(azure_credentials, str):
                 azure_credentials = json.loads(azure_credentials)
@@ -63,8 +65,6 @@ def initialize_service(self) -> None:
             kwargs["account_name"] = azure_credentials["ACCOUNT_NAME"]
             kwargs["account_key"] = azure_credentials.get("ACCOUNT_KEY")
             kwargs["sas_token"] = azure_credentials.get("SAS_TOKEN")
-        else:
-            kwargs["connection_string"] = self.connection_string
 
         blob_service = azure.storage.blob.BlockBlobService(**kwargs)
         self.service = blob_service


Test patch:
diff --git a/tests/engine/result_handlers/test_result_handlers.py b/tests/engine/result_handlers/test_result_handlers.py
--- a/tests/engine/result_handlers/test_result_handlers.py
+++ b/tests/engine/result_handlers/test_result_handlers.py
@@ -441,6 +441,22 @@ def test_azure_service_init_uses_custom_secrets(self, azure_service):
             "sas_token": None,
         }
 
+    def test_azure_service_init_uses_connection_string_over_secret(self, azure_service):
+        handler = AzureResultHandler(
+            container="bob", azure_credentials_secret="MY_FOO", connection_string="TEST"
+        )
+
+        with prefect.context(
+            secrets=dict(MY_FOO=dict(ACCOUNT_NAME=1, ACCOUNT_KEY=999))
+        ):
+            with set_temporary_config({"cloud.use_local_secrets": True}):
+                handler.initialize_service()
+
+        assert handler.container == "bob"
+        assert azure_service.call_args[1] == {
+            "connection_string": "TEST",
+        }
+
     def test_azure_service_writes_to_blob_prefixed_by_date_suffixed_by_prefect(
         self, azure_service
     ):