Hi Kamini,
You cannot change the datastore type or arbitrary top-level properties via ARM/Bicep once the default datastores exist — the service treats the datastore resource as immutable except for the credentials object. Your Bicep attempt failed because it tried to update immutable parts of the datastore.
Recommended approach :
Ensure the workspace has the user-assigned managed identity (or system identity) and that identity has Storage Blob Data Contributor on the storage account.
Update only the datastore credentials to use Managed Identity by calling the Azure ML REST API, Azure CLI, or the Azure ML SDK. Do not try to replace datastoreType or other immutable fields in the same operation.
Minimal options
A. Use az rest (PATCH) — run after deployment
az rest --method PATCH \
  --uri "https://management.azure.com/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.MachineLearningServices/workspaces/<ws>/datastores/<datastoreName>?api-version=2025-06-01" \
  --body '{
    "properties": {
      "credentials": {
        "credentialsType": "ManagedIdentity",
        "managedIdentity": {
          "resourceId": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identityName>"
        }
      },
      "serviceDataAccessAuthIdentity": {
        "type": "UserAssigned",
        "resourceId": "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<identityName>"
      }
    }
  }'
This PATCH modifies only credential-related properties. Adjust the identity resourceId to your UAI. Check the response and properties.credentials on the returned resource.
B. Use Azure ML SDK / Python (preferred for repeatable automation)
from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient
ml_client = MLClient(DefaultAzureCredential(), subscription_id, resource_group, workspace_name)
ds = ml_client.datastores.get("workspaceblobstore")
# update credentials to managed identity (pseudo-structure - set fields required by your SDK version)
ds.properties["credentials"] = {
  "credentialsType": "ManagedIdentity",
  "managedIdentity": {
    "resourceId": "/subscriptions/.../resourceGroups/.../providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityName"
  }
}
# push update (call/method name depends on SDK version)
ml_client.datastores.create_or_update("workspaceblobstore", ds)
(Use the exact method names for the azure-ai-ml version you have; the key point: update the credentials object only.)
C. If you must keep everything as IaC (Bicep) — add a deployment step
Deploy workspace with Bicep, then run a CLI/REST update as a post-deploy step. In Bicep you can add a Microsoft.Resources/deploymentScripts resource that executes the az rest or az ml command above as part of the deployment pipeline.
To Verify
After update, confirm properties.credentials.credentialsType is ManagedIdentity.
Confirm the workspace identity can access the storage account and that ML operations succeed.
Summary
ARM/Bicep cannot change immutable datastore properties except credentials.
Use the Azure ML REST API, CLI, or SDK to PATCH only the credentials (and set the appropriate serviceDataAccessAuthIdentity) to a managed identity.
- If you need this inside a Bicep deployment, run a post-deploy script (deploymentScript) that invokes the CLI/REST update.