docs: add PowerShell tab for az resource patch command in change streams#362
docs: add PowerShell tab for az resource patch command in change streams#362wttat wants to merge 1 commit intoMicrosoftDocs:mainfrom
Conversation
The existing az resource patch command uses Bash-style JSON escaping which fails in PowerShell. Added a tabbed section with both Bash and PowerShell variants so users on either shell can copy-paste correctly.
|
@wttat : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. @avijitgupta |
|
Learn Build status updates of commit 44cfab3: ✅ Validation status: passed
For more details, please refer to the build report. |
There was a problem hiding this comment.
Pull request overview
This PR updates the Change Streams documentation to provide shell-specific az resource patch examples so users can successfully enable the ChangeStreams preview feature when copy/pasting commands.
Changes:
- Adds tabbed Markdown content for Bash and PowerShell variants of the
az resource patchcommand. - Keeps the existing Bash example unchanged and introduces a PowerShell-specific quoting variant.
| # [PowerShell](#tab/powershell) | ||
|
|
||
| ```powershell | ||
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{\"previewFeatures\": [\"ChangeStreams\"]}' |
There was a problem hiding this comment.
The PowerShell example passes an invalid JSON string to --properties. Because the argument is wrapped in single quotes, the \" sequences are preserved and az receives {\"previewFeatures\": ...}, which isn't valid JSON (it starts with a backslash outside a JSON string). Use a PowerShell-safe quoting approach that results in {"previewFeatures": ["ChangeStreams"]} being passed to the CLI (for example, single quotes around a JSON string that contains unescaped double quotes).
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{\"previewFeatures\": [\"ChangeStreams\"]}' | |
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{"previewFeatures": ["ChangeStreams"]}' |
| # [Bash](#tab/bash) | ||
|
|
||
| ```bash | ||
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties "{\"previewFeatures\": [ \"ChangeStreams\"]}" | ||
| ``` | ||
|
|
||
| # [PowerShell](#tab/powershell) | ||
|
|
||
| ```powershell | ||
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{\"previewFeatures\": [\"ChangeStreams\"]}' | ||
| ``` | ||
|
|
||
| --- |
There was a problem hiding this comment.
The tabbed content block (tab headers, code fences, and the terminating ---) isn't indented under step 3, so it will render outside the numbered list item and can break the step formatting. Indent the entire tabbed block to nest it under the 3. list item (consistent with other docs that use tabs inside lists).
| # [Bash](#tab/bash) | |
| ```bash | |
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties "{\"previewFeatures\": [ \"ChangeStreams\"]}" | |
| ``` | |
| # [PowerShell](#tab/powershell) | |
| ```powershell | |
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{\"previewFeatures\": [\"ChangeStreams\"]}' | |
| ``` | |
| --- | |
| # [Bash](#tab/bash) | |
| ```bash | |
| az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties "{\"previewFeatures\": [ \"ChangeStreams\"]}" |
PowerShell
az resource patch --ids "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.DocumentDB/mongoClusters/<cluster-name>" --api-version 2024-10-01-preview --properties '{\"previewFeatures\": [\"ChangeStreams\"]}'|
Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
Problem
The
az resource patchcommand in the Change Streams article uses Bash-style JSON escaping (\"), which does not work in PowerShell. PowerShell handles quote escaping differently, causing the command to fail when users copy-paste it directly.Fix
Added a tabbed section (Bash / PowerShell) so users on either shell get the correct command syntax:
\"...\"escaping (unchanged)'\\\"escaping that PowerShell handles correctlyDocument
articles/documentdb/change-streams.md