Skip to content

Commit eb7a3f6

Browse files
committed
Updates from discussion
1 parent 2df5608 commit eb7a3f6

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

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

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -473,43 +473,9 @@ Managing modules in Azure Functions written in PowerShell can be approached in t
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

476-
#### Enabling Managed Dependencies
477-
478-
To enable managed dependencies, set the `managedDependency` property to `true` in the `host.json` file:
479-
480-
```json
481-
{
482-
"managedDependency": {
483-
"enabled": true
484-
}
485-
}
486-
```
487-
488-
#### Target Specific Versions
489-
490-
When targeting specific module versions, it’s important to follow both steps below to ensure the correct module version is loaded:
491-
492-
1. **Specify the module version in `requirements.psd1`:**
493-
494-
```powershell
495-
@{
496-
'Az.Accounts' = '1.9.5'
497-
}
498-
```
476+
#### Configuring requirements.psd1
499477

500-
2. **Add an import statement to `profile.ps1`:**
501-
502-
```powershell
503-
Import-Module Az.Accounts -RequiredVersion '1.9.5'
504-
```
505-
506-
This ensures the specified version is loaded when your function starts.
507-
508-
#### Dependency Management Considerations
509-
510-
- **Internet Access**: Managed dependencies require access to `https://www.powershellgallery.com` to download modules. Ensure that your environment allows this access.
511-
- **License Acceptance**: Modules that require license acceptance are not supported by managed dependencies.
512-
- **Flex Consumption Plan**: Managed dependencies are not supported in the Flex Consumption plan. Use custom modules instead.
478+
Content Here
513479

514480
#### Dependency Management App Settings
515481

@@ -571,7 +537,47 @@ PSFunctionApp
571537
| - requirements.psd1
572538
```
573539
574-
Modules in the `Modules` folder are automatically available to the runtime.
540+
When you start your function app, the PowerShell language worker adds this `Modules` folder to the `$env:PSModulePath` so that you can rely on module autoloading just as you would in a regular PowerShell script.
541+
542+
### Troubleshooting Managed Dependencies
543+
544+
#### Enabling Managed Dependencies
545+
546+
In order for Managed Dependencies to function, the feature must be enabled in host.json:
547+
548+
```json
549+
{
550+
"managedDependency": {
551+
"enabled": true
552+
}
553+
}
554+
```
555+
556+
#### Target Specific Versions
557+
558+
When targeting specific module versions, it’s important to follow both steps below to ensure the correct module version is loaded:
559+
560+
1. **Specify the module version in `requirements.psd1`:**
561+
562+
```powershell
563+
@{
564+
'Az.Accounts' = '1.9.5'
565+
}
566+
```
567+
568+
2. **Add an import statement to `profile.ps1`:**
569+
570+
```powershell
571+
Import-Module Az.Accounts -RequiredVersion '1.9.5'
572+
```
573+
574+
This ensures the specified version is loaded when your function starts.
575+
576+
#### Dependency Management Considerations
577+
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.
575581
576582
## Concurrency
577583

0 commit comments

Comments
 (0)