Skip to content

Commit 8aab623

Browse files
committed
Fix: Rename file and correct metadata for validation warnings
1 parent a6e093e commit 8aab623

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: about_SecureCode
3+
description: Learn best practices for writing secure PowerShell code, including module loading, credential handling, and constrained language mode.
4+
ms.date: 11/02/2025
5+
ms.topic: conceptual
6+
---
7+
8+
# about_SecureCode
9+
10+
## Short description
11+
Best practices for writing secure PowerShell code and scripts.
12+
13+
## Long description
14+
PowerShell is a powerful automation platform, but with great flexibility comes the need for careful attention to security.
15+
This article provides guidelines and recommendations for writing secure PowerShell scripts, functions, and modules.
16+
17+
These best practices help reduce exposure to malicious code execution, protect sensitive data, and ensure your scripts are safe to use across diverse environments.
18+
19+
---
20+
21+
## 1. Follow the principle of least privilege
22+
23+
Run scripts and commands with the **minimum permissions** required. Avoid using administrative rights unless absolutely necessary.
24+
Where possible, use **Just Enough Administration (JEA)** to define limited execution capabilities for users.
25+
26+
> For more information: [About JEA - Just Enough Administration](/powershell/scripting/learn/remoting/jea/overview)
27+
28+
---
29+
30+
## 2. Avoid auto-loading — explicitly import modules
31+
32+
Auto-loading modules can execute untrusted scripts automatically.
33+
Always **import modules explicitly** using:
34+
35+
```powershell
36+
Import-Module <ModuleName>
37+

reference/docs-conceptual/about_SecureCode.md

Whitespace-only changes.

0 commit comments

Comments
 (0)