Skip to content

Commit a59a0b6

Browse files
committed
More PR feedback
1 parent eb7a3f6 commit a59a0b6

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

articles/azure-functions/functions-reference-powershell.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -458,41 +458,41 @@ The function app restarts after the change is made to the configuration.
458458

459459
Managing modules in Azure Functions written in PowerShell can be approached in two ways: using the Managed Dependencies feature or including the modules directly in your app content. Each method has its own advantages, and choosing the right one depends on your specific needs.
460460

461-
### Choosing the Right Module Management Approach
461+
### Choosing the right module management approach
462462

463-
**Managed Dependencies Feature**
463+
**Why use the Managed Dependencies feature?**
464464
- **Simplified initial installation**: Automatically handles module installation based on your `requirements.psd1` file.
465465
- **Auto-upgrades**: Modules are updated automatically, including security fixes, without requiring manual intervention.
466466

467-
**Including Modules in App Content**
467+
**Why include modules in app content?**
468468
- **No dependency on the PowerShell Gallery**: Modules are bundled with your app, eliminating external dependencies.
469469
- **More control**: Avoids the risk of auto-upgrade regressions, giving you full control over which module versions are used.
470470
- **Compatibility**: Works on Flex Consumption and is recommended for other Linux SKUs.
471471

472-
### Managed Dependencies Feature
472+
### Managed Dependencies feature
473473

474474
The Managed Dependencies feature allows Azure Functions to automatically download and manage PowerShell modules specified in the `requirements.psd1` file. This is enabled by default in new PowerShell function apps.
475475

476476
#### Configuring requirements.psd1
477477

478-
Content Here
478+
To leverage Managed Dependencies in Azure Functions with PowerShell, you need to configure a `requirements.psd1` file. This file specifies the modules your function requires, and Azure Functions automatically downloads and updates these modules to ensure that your environment stays up-to-date.
479479

480-
#### Dependency Management App Settings
480+
Here is how to set up and configure the `requirements.psd1` file:
481481

482-
You can configure how managed dependencies are downloaded and installed using the following app settings:
482+
1. Create a `requirements.psd1` file in the root directory of your Azure Function if one does not already exist.
483+
2. Define the modules and their versions in a PowerShell data structure.
483484

484-
| Setting | Default Value | Description |
485-
|-----------------------------|---------------------------|--------------|
486-
| **MDMaxBackgroundUpgradePeriod** | `7.00:00:00` (seven days) | Controls the background update period for PowerShell function apps. |
487-
| **MDNewSnapshotCheckPeriod** | `01:00:00` (one hour) | Specifies how often the PowerShell worker checks for updates. |
488-
| **MDMinBackgroundUpgradePeriod** | `1.00:00:00` (one day) | Minimum time between upgrade checks. |
485+
Example `requirements.psd1` file:
486+
```powershell
487+
@{
488+
'Az' = '9.*' # Specifies the Az module and will use the latest version with major version 9
489+
}
490+
```
489491

490-
### Including Modules in App Content
492+
### Including modules in app content
491493

492494
For more control over your module versions and to avoid dependencies on external resources, you can include modules directly in your function app’s content.
493495

494-
#### Function App-Level Modules Folder
495-
496496
To include custom modules:
497497

498498
1. **Create a `Modules` folder** at the root of your function app.
@@ -553,7 +553,7 @@ In order for Managed Dependencies to function, the feature must be enabled in ho
553553
}
554554
```
555555

556-
#### Target Specific Versions
556+
#### Target specific versions
557557

558558
When targeting specific module versions, it’s important to follow both steps below to ensure the correct module version is loaded:
559559

@@ -573,11 +573,21 @@ When targeting specific module versions, it’s important to follow both steps b
573573
574574
This ensures the specified version is loaded when your function starts.
575575
576-
#### Dependency Management Considerations
576+
#### Configure specific Managed Dependency interval settings
577+
578+
You can configure how Managed Dependencies are downloaded and installed using the following app settings:
579+
580+
| Setting | Default Value | Description |
581+
|-----------------------------|---------------------------|--------------|
582+
| **MDMaxBackgroundUpgradePeriod** | `7.00:00:00` (seven days) | Controls the background update period for PowerShell function apps. |
583+
| **MDNewSnapshotCheckPeriod** | `01:00:00` (one hour) | Specifies how often the PowerShell worker checks for updates. |
584+
| **MDMinBackgroundUpgradePeriod** | `1.00:00:00` (one day) | Minimum time between upgrade checks. |
585+
586+
#### Dependency management considerations
577587
578-
- **Internet Access**: Managed dependencies require access to `https://www.powershellgallery.com` to download modules. Ensure that your environment allows this access.
579-
- **License Acceptance**: Modules that require license acceptance are not supported by managed dependencies.
580-
- **Flex Consumption Plan**: Managed dependencies are not supported in the Flex Consumption plan. Use custom modules instead.
588+
- **Internet Access**: Managed Dependencies require access to `https://www.powershellgallery.com` to download modules. Ensure that your environment allows this access, including modifying firewall/VNet rules as needed.
589+
- **License Acceptance**: Modules that require license acceptance are not supported by Managed Dependencies.
590+
- **Flex Consumption Plan**: Managed Dependencies are not supported in the Flex Consumption plan. Use custom modules instead.
581591
582592
## Concurrency
583593
@@ -685,7 +695,7 @@ When you work with PowerShell functions, be aware of the considerations in the f
685695

686696
When developing Azure Functions in the [serverless hosting model](consumption-plan.md), cold starts are a reality. *Cold start* refers to period of time it takes for your function app to start running to process a request. Cold start happens more frequently in the Consumption plan because your function app gets shut down during periods of inactivity.
687697

688-
#### Avoid Using Install-Module
698+
#### Avoid using Install-Module
689699

690700
Running `Install-Module` in your function script on each invocation can cause performance issues. Instead, use `Save-Module` or `Save-PSResource` before publishing your function app to bundle the necessary modules.
691701

0 commit comments

Comments
 (0)