We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Fallback to DefaultAzureCredential isn't compatible with AzureDeveloperCliCredential
**Describe the bug**

PromptFlow currently falls back to using DefaultAzureCredential and fetching a token for the Oauth 1.0 audience. That is not compatible with all credentials in the chain, specifically, the AzureDeveloperCliCredential which is Oauth 2.0 only. This PR changes the audience value to the correct scope value, and renames variables accordingly.


**How To Reproduce the bug**
Steps to reproduce the behavior, how frequent can you experience the bug:
1. Run `azd auth login` and DONT login to Azure CLI
2. Run ai-rag-chat-evaluator or other sample code that does *not* specify a credential when using the evaluators/evaluate function


PR incoming!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/promptflow-core/promptflow/_core/token_provider.py`
Content:
```
1 import threading
2 from abc import ABC, abstractmethod
3 from promptflow.exceptions import UserErrorException
4 from promptflow._utils.credential_utils import get_default_azure_credential
5 
6 
7 # to access azure ai services, we need to get the token with this audience
8 COGNITIVE_AUDIENCE = "https://cognitiveservices.azure.com/"
9 
10 
11 class TokenProviderABC(ABC):
12     def __init__(self) -> None:
13         super().__init__()
14 
15     @abstractmethod
16     def get_token(self) -> str:
17         pass
18 
19 
20 class StaticTokenProvider(TokenProviderABC):
21     def __init__(self, token: str) -> None:
22         super().__init__()
23         self.token = token
24 
25     def get_token(self) -> str:
26         return self.token
27 
28 
29 class AzureTokenProvider(TokenProviderABC):
30     _instance_lock = threading.Lock()
31     _instance = None
32 
33     def __new__(cls, *args, **kwargs):
34         with cls._instance_lock:
35             if not cls._instance:
36                 cls._instance = super().__new__(cls)
37                 cls._instance._init_instance()
38             return cls._instance
39 
40     def _init_instance(self):
41         try:
42             # Initialize a credential instance
43             self.credential = get_default_azure_credential()
44         except ImportError as ex:
45             raise UserErrorException(
46                 "Failed to initialize AzureTokenProvider. "
47                 + f"Please try 'pip install azure.identity' to install dependency, {ex.msg}."
48             )
49 
50     def get_token(self):
51         audience = COGNITIVE_AUDIENCE
52         return self.credential.get_token(audience).token
53
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/promptflow-core/promptflow/_core/token_provider.py b/src/promptflow-core/promptflow/_core/token_provider.py
--- a/src/promptflow-core/promptflow/_core/token_provider.py
+++ b/src/promptflow-core/promptflow/_core/token_provider.py
@@ -4,8 +4,8 @@
 from promptflow._utils.credential_utils import get_default_azure_credential
 
 
-# to access azure ai services, we need to get the token with this audience
-COGNITIVE_AUDIENCE = "https://cognitiveservices.azure.com/"
+# to access azure ai services, we need to get the token with this scope
+COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default"
 
 
 class TokenProviderABC(ABC):
@@ -48,5 +48,5 @@
             )
 
     def get_token(self):
-        audience = COGNITIVE_AUDIENCE
-        return self.credential.get_token(audience).token
+        scope = COGNITIVE_SCOPE
+        return self.credential.get_token(scope).token

{"golden_diff": "diff --git a/src/promptflow-core/promptflow/_core/token_provider.py b/src/promptflow-core/promptflow/_core/token_provider.py\n--- a/src/promptflow-core/promptflow/_core/token_provider.py\n+++ b/src/promptflow-core/promptflow/_core/token_provider.py\n@@ -4,8 +4,8 @@\n from promptflow._utils.credential_utils import get_default_azure_credential\n \n \n-# to access azure ai services, we need to get the token with this audience\n-COGNITIVE_AUDIENCE = \"https://cognitiveservices.azure.com/\"\n+# to access azure ai services, we need to get the token with this scope\n+COGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\"\n \n \n class TokenProviderABC(ABC):\n@@ -48,5 +48,5 @@\n             )\n \n     def get_token(self):\n-        audience = COGNITIVE_AUDIENCE\n-        return self.credential.get_token(audience).token\n+        scope = COGNITIVE_SCOPE\n+        return self.credential.get_token(scope).token\n", "issue": "[BUG] Fallback to DefaultAzureCredential isn't compatible with AzureDeveloperCliCredential\n**Describe the bug**\r\n\r\nPromptFlow currently falls back to using DefaultAzureCredential and fetching a token for the Oauth 1.0 audience. That is not compatible with all credentials in the chain, specifically, the AzureDeveloperCliCredential which is Oauth 2.0 only. This PR changes the audience value to the correct scope value, and renames variables accordingly.\r\n\r\n\r\n**How To Reproduce the bug**\r\nSteps to reproduce the behavior, how frequent can you experience the bug:\r\n1. Run `azd auth login` and DONT login to Azure CLI\r\n2. Run ai-rag-chat-evaluator or other sample code that does *not* specify a credential when using the evaluators/evaluate function\r\n\r\n\r\nPR incoming!\n", "before_files": [{"content": "import threading\nfrom abc import ABC, abstractmethod\nfrom promptflow.exceptions import UserErrorException\nfrom promptflow._utils.credential_utils import get_default_azure_credential\n\n\n# to access azure ai services, we need to get the token with this audience\nCOGNITIVE_AUDIENCE = \"https://cognitiveservices.azure.com/\"\n\n\nclass TokenProviderABC(ABC):\n    def __init__(self) -> None:\n        super().__init__()\n\n    @abstractmethod\n    def get_token(self) -> str:\n        pass\n\n\nclass StaticTokenProvider(TokenProviderABC):\n    def __init__(self, token: str) -> None:\n        super().__init__()\n        self.token = token\n\n    def get_token(self) -> str:\n        return self.token\n\n\nclass AzureTokenProvider(TokenProviderABC):\n    _instance_lock = threading.Lock()\n    _instance = None\n\n    def __new__(cls, *args, **kwargs):\n        with cls._instance_lock:\n            if not cls._instance:\n                cls._instance = super().__new__(cls)\n                cls._instance._init_instance()\n            return cls._instance\n\n    def _init_instance(self):\n        try:\n            # Initialize a credential instance\n            self.credential = get_default_azure_credential()\n        except ImportError as ex:\n            raise UserErrorException(\n                \"Failed to initialize AzureTokenProvider. \"\n                + f\"Please try 'pip install azure.identity' to install dependency, {ex.msg}.\"\n            )\n\n    def get_token(self):\n        audience = COGNITIVE_AUDIENCE\n        return self.credential.get_token(audience).token\n", "path": "src/promptflow-core/promptflow/_core/token_provider.py"}], "after_files": [{"content": "import threading\nfrom abc import ABC, abstractmethod\nfrom promptflow.exceptions import UserErrorException\nfrom promptflow._utils.credential_utils import get_default_azure_credential\n\n\n# to access azure ai services, we need to get the token with this scope\nCOGNITIVE_SCOPE = \"https://cognitiveservices.azure.com/.default\"\n\n\nclass TokenProviderABC(ABC):\n    def __init__(self) -> None:\n        super().__init__()\n\n    @abstractmethod\n    def get_token(self) -> str:\n        pass\n\n\nclass StaticTokenProvider(TokenProviderABC):\n    def __init__(self, token: str) -> None:\n        super().__init__()\n        self.token = token\n\n    def get_token(self) -> str:\n        return self.token\n\n\nclass AzureTokenProvider(TokenProviderABC):\n    _instance_lock = threading.Lock()\n    _instance = None\n\n    def __new__(cls, *args, **kwargs):\n        with cls._instance_lock:\n            if not cls._instance:\n                cls._instance = super().__new__(cls)\n                cls._instance._init_instance()\n            return cls._instance\n\n    def _init_instance(self):\n        try:\n            # Initialize a credential instance\n            self.credential = get_default_azure_credential()\n        except ImportError as ex:\n            raise UserErrorException(\n                \"Failed to initialize AzureTokenProvider. \"\n                + f\"Please try 'pip install azure.identity' to install dependency, {ex.msg}.\"\n            )\n\n    def get_token(self):\n        scope = COGNITIVE_SCOPE\n        return self.credential.get_token(scope).token\n", "path": "src/promptflow-core/promptflow/_core/token_provider.py"}]}