Skip to content

azurerm_ai_services - mark as deprecated for 5.0#31809

Open
ZiChuanBuXiu wants to merge 10 commits intohashicorp:mainfrom
ZiChuanBuXiu:dp/deprecate-ai-service
Open

azurerm_ai_services - mark as deprecated for 5.0#31809
ZiChuanBuXiu wants to merge 10 commits intohashicorp:mainfrom
ZiChuanBuXiu:dp/deprecate-ai-service

Conversation

@ZiChuanBuXiu
Copy link
Copy Markdown
Contributor

@ZiChuanBuXiu ZiChuanBuXiu commented Feb 24, 2026

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

Mark azurerm_ai_services as deprecated for 5.0 as it's replaced by azurerm_cognitive_account

  • Use azurerm_cognitive_account as DeprecatedInFavourOfResource for azurerm_ai_services
  • Add conditional skip for azurerm_ai_services acceptance tests
  • Add conditional check for resource registration
  • Remove reference for azurerm_ai_services
    • Resource template in AI Foundry test
    • Code samples in AI Foundry/AI Foundry Project document
  • Update ai_services.html.markdown to indicate deprecation
  • Add migration guide in 5.0-upgrade-guide.html.markdown

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Acceptance test for Cognitive AI Services

image

Acceptance test for AI Foundry

image

Verification test for deprecation warning

Deprecate warning

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_ai_services - Deprecate for 5.0 in favour of azurerm_cognitive_account [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

promisinganuj
promisinganuj previously approved these changes Feb 27, 2026
Copy link
Copy Markdown
Collaborator

@promisinganuj promisinganuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Copy Markdown
Collaborator

@magodo magodo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!
I have left some additional mostly minor comments that once addressed this should be good to merge 👍

Comment thread internal/services/machinelearning/ai_foundry_resource_test.go
magodo
magodo previously approved these changes Feb 27, 2026
@ZiChuanBuXiu ZiChuanBuXiu dismissed stale reviews from magodo and promisinganuj via bad3e53 March 4, 2026 05:55
@gerrytan gerrytan self-requested a review March 5, 2026 00:01
Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ZiChuanBuXiu , I left some question and feedbacks. Please also trigger another run of acctest if you push a commit. You can run only relevant test using the tctest tool.

| (not present) | `kind` | **Required**. Set to `"AIServices"` to match the behaviour of `azurerm_ai_services`. |
| `local_authentication_enabled` | `local_auth_enabled` | **Renamed**. Both default to `true`. |
| `public_network_access` | `public_network_access_enabled` | **Changed type**. String (`"Enabled"` / `"Disabled"`) → Boolean (`true` / `false`). Defaults to `true`. |
| (not present) | `project_management_enabled` |**Required**. Set to `true` to match the behaviour of `azurerm_ai_services`. |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_management_enabled is not a required field in cognitive_account. Also in ai_services we never set any value. Are you saying the API default when it's nil is equal to true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a "REQUIRED" field but it's required to be set to true during migration, otherwise it will force a new resource to be created based on this instruction.

I may change the wording to Mandatory to make it less confusing with the "Required" field terminology?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add some more context, project_management_enabled flag is optional and false by default as it's not applicable to other kinds. Users should be setting the project_management_enabled to true when kind is set to AIServices. Without it, users can't create projects within the account which defeats the purpose.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it thanks!

Also noted we already got a CustomizeDiff check for this in cognitive_account:

internal/services/cognitive/cognitive_account_resource.go

			if d.Get("project_management_enabled").(bool) {
				if kind != "AIServices" {
					return errors.New("`project_management_enabled` can only be set to `true` when `kind` is set to `AIServices`")
				}

| `local_authentication_enabled` | `local_auth_enabled` | **Renamed**. Both default to `true`. |
| `public_network_access` | `public_network_access_enabled` | **Changed type**. String (`"Enabled"` / `"Disabled"`) → Boolean (`true` / `false`). Defaults to `true`. |
| (not present) | `project_management_enabled` |**Required**. Set to `true` to match the behaviour of `azurerm_ai_services`. |
| `customer_managed_key.managed_hsm_key_id` | (not present) | `customer_managed_key.managed_hsm_key_id` is not present in `azurerm_cognitive_account`. Try update to use `customer_managed_key.key_vault_key_id` before migration. |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs grammatical improvement

Suggested change
| `customer_managed_key.managed_hsm_key_id` | (not present) | `customer_managed_key.managed_hsm_key_id` is not present in `azurerm_cognitive_account`. Try update to use `customer_managed_key.key_vault_key_id` before migration. |
| `customer_managed_key.managed_hsm_key_id` | (not present) | Use `customer_managed_key.key_vault_key_id` property, it can accept both regular and HSM key id. |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


### `azurerm_ai_services`

* This deprecated resource has been retired and has been removed from the Azure Provider.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the wording format for superseded removal

Suggested change
* This deprecated resource has been retired and has been removed from the Azure Provider.
* This deprecated resource has been superseded by `azurerm_cognitive_account` and has been removed from the Azure Provider.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


Manages an AI Services Account.

~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account) resource instead.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not hardcode full URI, use relative link instead

Suggested change
~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account) resource instead.
~> **Note:** The `azurerm_ai_services` resource has been deprecated and will be removed in v5.0 of the AzureRM Provider. Please use [`azurerm_cognitive_account`](cognitive_account.html.markdown) resource instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@ZiChuanBuXiu ZiChuanBuXiu requested a review from gerrytan March 5, 2026 23:20
Copy link
Copy Markdown
Collaborator

@promisinganuj promisinganuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have triggered a fresh set of acctests:

  1. https://hashicorp.teamcity.com/viewQueued.html?itemId=624587
  2. https://hashicorp.teamcity.com/viewQueued.html?itemId=624586

And have pinged @magodo to run the GH workflow.

Assuming all the result is good, this PR is good to go. Nice work @ZiChuanBuXiu !

| (not present) | `kind` | **Required**. Set to `"AIServices"` to match the behaviour of `azurerm_ai_services`. |
| `local_authentication_enabled` | `local_auth_enabled` | **Renamed**. Both default to `true`. |
| `public_network_access` | `public_network_access_enabled` | **Changed type**. String (`"Enabled"` / `"Disabled"`) → Boolean (`true` / `false`). Defaults to `true`. |
| (not present) | `project_management_enabled` |**Required**. Set to `true` to match the behaviour of `azurerm_ai_services`. |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it thanks!

Also noted we already got a CustomizeDiff check for this in cognitive_account:

internal/services/cognitive/cognitive_account_resource.go

			if d.Get("project_management_enabled").(bool) {
				if kind != "AIServices" {
					return errors.New("`project_management_enabled` can only be set to `true` when `kind` is set to `AIServices`")
				}

@gerrytan

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants