Skip to content

docs: add PowerShell tab for az resource patch command in change streams#362

Open
wttat wants to merge 1 commit intoMicrosoftDocs:mainfrom
wttat:fix/change-streams-powershell-escape
Open

docs: add PowerShell tab for az resource patch command in change streams#362
wttat wants to merge 1 commit intoMicrosoftDocs:mainfrom
wttat:fix/change-streams-powershell-escape

Conversation

@wttat
Copy link
Copy Markdown

@wttat wttat commented Mar 24, 2026

Problem

The az resource patch command 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:

  • Bash: keeps the existing \"...\" escaping (unchanged)
  • PowerShell: uses single-quoted string with '\\\" escaping that PowerShell handles correctly

Document

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.
@prmerger-automator
Copy link
Copy Markdown
Contributor

@wttat : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. @avijitgupta

@learn-build-service-prod
Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 44cfab3:

✅ Validation status: passed

File Status Preview URL Details
articles/documentdb/change-streams.md ✅Succeeded

For more details, please refer to the build report.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 patch command.
  • 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\"]}'
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
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"]}'

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +53
# [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\"]}'
```

---
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

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).

Suggested change
# [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\"]}'

Copilot uses AI. Check for mistakes.
@ttorble
Copy link
Copy Markdown
Contributor

ttorble commented Mar 24, 2026

@AvijitkGupta

Can you review the proposed changes?

IMPORTANT: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged C+L Pull Request Review Team label label Mar 24, 2026
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.

4 participants