auth-required
@azure-tools/typespec-azure-core/auth-requiredEnforce service authentication.
Ensure Azure services define their authentication requirements. See https://azure.github.io/typespec-azure/docs/reference/azure-style-guide#security-definitions
Impact
Section titled “Impact”- Area: API, SDK
All ARM APIs share the same authentication, so a violation has no runtime effect on the API or SDK. It usually indicates the root namespace is missing its provider registration.
❌ Incorrect
Section titled “❌ Incorrect”@servicenamespace Azure.Service;✅ Correct
Section titled “✅ Correct”- OAuth2
@useAuth(AADToken)namespace Contoso.WidgetManager;
/** The Azure Active Directory OAuth2 Flow */model AADToken is OAuth2Auth<[ { type: OAuth2FlowType.authorizationCode; authorizationUrl: "https://api.example.com/oauth2/authorize"; tokenUrl: "https://api.example.com/oauth2/token"; scopes: ["https://management.azure.com/read", "https://management.azure.com/write"]; } ]>;- Api Key
@useAuth(AzureKey)namespace Contoso.WidgetManager;
/** The secret key for your Azure Cognitive Services subscription. */model AzureKey is ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">;Suppression
Section titled “Suppression”This should essentially never occur. Rather than suppressing, add @armProviderNamespace to the root namespace.