az provider register without `--subscription` does not enable web_search feature as expected
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 3.5k
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 60
Description
### Describe the bug
When enabling the Azure OpenAI web search tool by unregistering the feature flag `OpenAI.BlockedTools.web_search`, running:
```shell
az provider register -n Microsoft.CognitiveServices
```
does not properly apply the change to the intended subscription.
As a result, even after:
- Successfully unregistering the feature flag
- Running the provider registration command
the web search tool remains unavailable and returns the following error:
```shell
Tool 'web_search_preview' disabled for this organization.
```
However, when explicitly specifying the subscription:
```shell
az provider register -n Microsoft.CognitiveServices --subscription
```
the issue is resolved and the web search tool starts working correctly.
This indicates that the CLI command without `--subscription` may not target the expected subscription, or the documentation does not clearly state the requirement.
### Related command
```shell
az feature unregister \
--name OpenAI.BlockedTools.web_search \
--namespace Microsoft.CognitiveServices
az provider register -n Microsoft.CognitiveServices
```
Working command:
```shell
az provider register -n Microsoft.CognitiveServices --subscription
```
### Errors
```
Error code: 400
{
"error": {
"message": "Tool 'web_search_preview' disabled for this organization.",
"type": "invalid_request_error",
"param": "tools"
}
}
```
### Issue script & Debug output
Example request:
```python
from openai import OpenAI
import os
client = OpenAI(
api_key=os.getenv("AZURE_OPENAI_API_KEY"),
base_url="https://.openai.azure.com/openai/v1/",
)
response = client.responses.create(
model="gpt-5-4-deployment", # deployment name
tools=[{"type": "web_search"}],
input="Give me a positive news story from the web today"
)
print(response.output_text)
```
Observed behavior:
- Even after unregistering the feature flag and running az provider register
- The request is still routed to web_search_preview and fails
After running:
```
az provider register -n Microsoft.CognitiveServices --subscription
```
The same request succeeds.
### Expected behavior
- Running:
```
az provider register -n Microsoft.CognitiveServices
```
should correctly apply to the active subscription context (as per `az account show`)
OR
- Documentation should clearly state that `--subscription` must be explicitly specified to ensure correct propagation
### Environment Summary
```
azure-cli 2.84.0
core 2.84.0
telemetry 1.1.0
Extensions:
communication 1.14.0
containerapp 1.3.0b4
ml 2.42.0
Dependencies:
msal 1.35.0b1
azure-mgmt-resource 24.0.0
Python location '/opt/homebrew/Cellar/azure-cli/2.84.0/libexec/bin/python'
Config directory '/Users/koheisaito/.azure'
Extensions directory '/Users/koheisaito/.azure/cliextensions'
Python (Darwin) 3.13.12 (main, Feb 3 2026, 17:53:27) [Clang 17.0.0 (clang-1700.6.3.2)]
```
### Additional context
- The issue is likely to occur in environments where:
- Multiple subscriptions exist under the same tenant
- The default subscription context is not clearly aligned with the target Azure OpenAI resource
- Current official documentation and CLI guidance only mention:
```
az provider register -n Microsoft.CognitiveServices
```
without clarifying subscription scope
This can lead to silent misconfiguration where:
- Feature flag appears correctly set
- But provider registration is not applied to the correct subscription
- Suggestion:
- Update documentation to explicitly recommend:
```
az provider register -n Microsoft.CognitiveServices --subscription
```
- Or clarify how subscription context is resolved
Contributor guide
Assessment
This issue has not been assessed yet.