Skip to content

Conversation

@Shriya-23
Copy link

Adds a new conceptual article: about_SecureCode.

This PR documents best practices for writing secure PowerShell code, including module importing, least privilege, and Constrained Language Mode.

Fixes #10099

Summary

This PR adds a new conceptual article — about_SecureCode — that provides best practices for writing secure PowerShell code and scripts.

Related Issue

Fixes #10099

Details

  • Introduces guidance on writing secure PowerShell code.
  • Covers key principles like least privilege, module importing, credential protection, and Constrained Language Mode.
  • Adds cross-references to existing Microsoft Docs on PowerShell security.
  • Follows the structure and metadata conventions for conceptual topics.

Testing

  • Verified Markdown formatting and metadata structure.
  • No build or link errors during local validation.

Contributed by: @Shriya-23

@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit a6e093e:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/docs-conceptual/about_SecureCode.md ⚠️Warning View (>=powershell-5.1) Details

reference/docs-conceptual/about_SecureCode.md

  • Line 0, Column 0: [Warning: h1-missing - See documentation] H1 is required. Use a single hash (#) followed by a space to create your top-level heading.
  • Line 0, Column 0: [Warning: filename-invalid-character - See documentation] Only lowercase letters, numbers, and hyphens are allowed in filenames.
  • Line 1, Column 1: [Warning: title-missing - See documentation] Missing required attribute: 'title'. Add a title string to show in search engine results.
  • Line 0, Column 0: [Suggestion: filename-incomplete - See documentation] The filename contains an incomplete word, misspelled word, acronym, or abbreviation that is disallowed.
  • Line 1, Column 1: [Suggestion: ms-date-missing - See documentation] Missing required attribute: 'ms.date'.
  • Line 1, Column 1: [Suggestion: description-missing - See documentation] Missing required attribute: 'description'.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@Shriya-23
Copy link
Author

Hi team 👋

I came across Issue #10099 about adding a topic on secure PowerShell coding practices, so I created a new about_SecureCode article. It covers key points like safe module loading, proper credential handling, and writing scripts that work well with Constrained Language Mode ,all based on Microsoft’s existing security guidelines and blogs.

I’ve done my best to follow the repo’s structure and tone, but since I’m still learning, I’d really appreciate any feedback or suggestions you might have

Thank you so much for keeping this project open to new contributors,it means a lot to learners like me who are just starting out.😊

@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 8aab623:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/docs-conceptual/about-secure-code.md ⚠️Warning View (>=powershell-5.1) Details

reference/docs-conceptual/about-secure-code.md

  • Line 35, Column 1: [Warning: code-block-unclosed - See documentation] Unclosed code block. Code blocks must begin and end with triple backticks (```).

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@Shriya-23
Copy link
Author

@microsoft-github-policy-service agree

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 698b3d8:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/docs-conceptual/about-secure-code.md ⚠️Warning View (>=powershell-5.1) Details

reference/docs-conceptual/about-secure-code.md

  • Line 37, Column 1: [Warning: code-block-unclosed - See documentation] Unclosed code block. Code blocks must begin and end with triple backticks (```).

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit afd2b40:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/docs-conceptual/about-secure-code.md ⚠️Warning View (>=powershell-5.1) Details

reference/docs-conceptual/about-secure-code.md

  • Line 37, Column 1: [Warning: code-block-unclosed - See documentation] Unclosed code block. Code blocks must begin and end with triple backticks (```).

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 2a5ba3e:

❌ Validation status: errors

Please follow instructions here which may help to resolve issue.

File Status Preview URL Details
❌Error Details

  • Line 0, Column 0: [Error: download-failed] Download failed for file 'https://opdhsblobprod03.blob.core.windows.net/contents/1d5626c75f5749019b247cd327e78605/293488b5f021714084202a3eb2470ff5'. Try closing and reopening the PR. If you get this Error again, file an issue.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@Shriya-23
Copy link
Author

Hi maintainers
I’ve verified that my Markdown fix is correct, it seems the latest build failed due to a temporary “download-failed” issue unrelated to the content.
I’ve reopened the PR to trigger a fresh build.

As this is one of my first contributions here, I truly appreciate your patience and guidance throughout the process.
Looking forward to your feedback and hoping this PR can be merged soon 💙

@Shriya-23 Shriya-23 closed this Nov 2, 2025
@Shriya-23 Shriya-23 reopened this Nov 2, 2025
@learn-build-service-prod
Copy link
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@learn-build-service-prod
Copy link
Contributor

Learn Build status updates of commit 2a5ba3e:

⚠️ Validation status: warnings

File Status Preview URL Details
reference/docs-conceptual/about-secure-code.md ⚠️Warning View (>=powershell-5.1) Details

reference/docs-conceptual/about-secure-code.md

  • Line 37, Column 1: [Warning: code-block-unclosed - See documentation] Unclosed code block. Code blocks must begin and end with triple backticks (```).

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

@sdwheeler
Copy link
Collaborator

Thanks for your contribution. However, we already have many documents on using PowerShell securely.

See https://learn.microsoft.com/powershell/scripting/security/overview.

In the future, before you start writing a new article, open an Issue so we can discuss the ideas provide guidance.

@sdwheeler sdwheeler closed this Nov 3, 2025
@sdwheeler sdwheeler added the do-not-merge Tag - closed without merging label Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Tag - closed without merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add topic about best practices for writing secure code

2 participants