resource-envelope-schema
@azure-tools/typespec-azure-resource-manager/resource-envelope-schemaValidate identity properties and tags in the ARM resource envelope.
The ARM resource envelope must contain read-only name, id, and type properties. If the envelope includes tags, its values must be strings.
Impact
Section titled “Impact”- Area: API, SDK
Missing or writable resource identity properties violate ARM guidelines. Non-string tag values do not conform to the Azure resource tags schema and can prevent SDK generation.
❌ Incorrect
Section titled “❌ Incorrect”Resource identity properties are writable
Section titled “Resource identity properties are writable”Assume Widget is an ARM resource. Its id and type properties must be read-only in the resource hierarchy:
model WidgetProperties { displayName?: string;}
model Widget is TrackedResource<WidgetProperties> { @visibility(Lifecycle.Read, Lifecycle.Create) id?: Azure.Core.armResourceIdentifier;}Tags use non-string values
Section titled “Tags use non-string values”tags?: Record<int32>;✅ Correct
Section titled “✅ Correct”Resource identity properties are read-only
Section titled “Resource identity properties are read-only”Use the standard ARM resource base types, which provide read-only name, id, and type properties:
model WidgetProperties { displayName?: string;}
model Widget is TrackedResource<WidgetProperties> { ...ResourceNameParameter<Widget>;}Tags use string values
Section titled “Tags use string values”Use TrackedResource<WidgetProperties>, which provides the standard tags property. Do not redeclare tags on the resource model.
Suppression
Section titled “Suppression”Fix the resource model to follow the ARM resource property and tags requirements. Exceptions should only be granted to match existing stable legacy API.
LintDiff Equivalent
Section titled “LintDiff Equivalent”This rule combines RequiredPropertiesMissingInResourceModel and AzureResourceTagsSchema.