From fd3929bd204ac8f8e3042c2531672bad3df36a8a Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 4 Sep 2018 16:30:08 -0700 Subject: [PATCH 1/4] more official readme with steps --- README.md | 80 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ce4682f6..321fcd29 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,69 @@ -# PSWorkerPrototype -Prototype for Azure Functions PowerShell Language Worker +# Azure Functions PowerShell Language Worker -## Steps +This repository will host the PowerShell language worker implementation for Azure Functions. We'll also be using it to track work items related to PowerShell support. Please feel free to leave comments about any of the features and design patterns. -1. Modify `DefaultExecutablePath` in `worker.config.json` (to something like this `"C:\\Program Files\\dotnet\\dotnet.exe"`) -2. `cd path/to/PSWorkerPrototype` -3. `dotnet publish` -4. Run: +> 🚧 The project is currently work in progress. Please do not use in production as we expect developments over time. To receive important updates, including breaking changes announcements, watch the Azure App Service announcements repository. 🚧 -```powershell -# Windows if you installed the Azure Functions Core Tools via npm -Remove-Item -Recurse -Force ~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\powershell -Copy-Item src\bin\Debug\netcoreapp2.1\publish ~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\powershell -Recurse -Force +## Overview -# macOS if you installed the Azure Functions Core Tools via brew -Remove-Item -Recurse -Force /usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.33/workers/powershell -Copy-Item src/bin/Debug/netcoreapp2.1/publish /usr/local/Cellar/azure-functions-core-tools/2.0.1-beta.33/workers/powershell -Recurse -Force -``` \ No newline at end of file +PowerShell support for Functions is based on [PowerShell Core 6.1](https://github.com/powershell/powershell), [Functions on Linux](https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/functions-on-linux-preview/), and the [V2 Runtime](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions). + +What's available? + +* Develop using Functions Core Tools (CLI) +* Triggers / Bindings (some untested) : HTTP/Webhook, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus + +What's coming? + +A ton of good things. + +## Contributing + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Building from source + +### Prereqs + +* [.NET 2.1 SDK](https://www.microsoft.com/net/download/visual-studio-sdks) + +### Build + +* Clone this repository +* `cd azure-functions-powershell-worker` +* `dotnet publish` + +### Run & Debug + +The PowerShell worker alone is not enough to establish the functions app, we also need the support from [Azure Functions Host](https://github.com/Azure/azure-functions-host). You may either use a published host CLI or use the in-development host. But both of the methods require you to attach to the .NET process if you want a step-by-step debugging experience. + +#### Published Host + +You can install the latest Azure functions CLI tool by: + +```sh +npm install -g azure-functions-core-tools@core +``` + +By default, the binaries are located in `"/.azurefunctions/bin"`. Copy the `"/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"/.azurefunctions/bin/workers/powershell/"`. And start it normally using: + +```sh +func start +``` + +#### Latest Host + +A developer may also use the latest host code by cloning the git repository [Azure Functions Host](https://github.com/Azure/azure-functions-host). Now you need to navigate to the root folder of the host project and build it through: + +```sh +dotnet restore WebJobs.Script.sln +dotnet build WebJobs.Script.sln +``` + +After the build succeeded, set the environment variable `"AzureWebJobsScriptRoot"` to the root folder path (the folder which contains the `host.json`) of your test functions app; and copy the `"/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"/src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.0/workers/powershell"`. Now it's time to start the host: + +```sh +dotnet ./src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.0/Microsoft.Azure.WebJobs.Script.WebHost.dll +``` + +> Note: Remember to remove `"AzureWebJobsScriptRoot"` environment variable after you have finished debugging, because it will also influence the `func` CLI tool. From 249c4c07aa674929b015572cb365be0ead180941 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 5 Sep 2018 09:14:14 -0700 Subject: [PATCH 2/4] updated what's currently available --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 321fcd29..6f83bba3 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,16 @@ This repository will host the PowerShell language worker implementation for Azur ## Overview -PowerShell support for Functions is based on [PowerShell Core 6.1](https://github.com/powershell/powershell), [Functions on Linux](https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/functions-on-linux-preview/), and the [V2 Runtime](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions). +PowerShell support for Functions is based on [PowerShell Core 6.1](https://github.com/powershell/powershell), [Functions on Linux](https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/functions-on-linux-preview/), and the [Azure Functions runtime V2](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions). What's available? -* Develop using Functions Core Tools (CLI) -* Triggers / Bindings (some untested) : HTTP/Webhook, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus +* Triggers / Bindings : HTTP/Webhook What's coming? -A ton of good things. +* More triggers and bindings +* A bunch of other good things ## Contributing From 0eb7cd148e27d9adade4f3bb2d63dd75836d8a0e Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 5 Sep 2018 09:15:02 -0700 Subject: [PATCH 3/4] added one more bullet point --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6f83bba3..f86bae2c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ What's available? What's coming? * More triggers and bindings +* Tooling integration * A bunch of other good things ## Contributing From 406edf9e74a37f5649702a28299bc29689fdd3aa Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 6 Sep 2018 01:18:09 -0700 Subject: [PATCH 4/4] address feedback --- README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 321fcd29..819fb25a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,19 @@ # Azure Functions PowerShell Language Worker -This repository will host the PowerShell language worker implementation for Azure Functions. We'll also be using it to track work items related to PowerShell support. Please feel free to leave comments about any of the features and design patterns. +This repository will host the PowerShell language worker implementation for Azure Functions. +We'll also be using it to track work items related to PowerShell support. +Please feel free to leave comments about any of the features and design patterns. -> 🚧 The project is currently work in progress. Please do not use in production as we expect developments over time. To receive important updates, including breaking changes announcements, watch the Azure App Service announcements repository. 🚧 +> 🚧 The project is currently **work in progress**. +Please do not use in production as we expect developments over time. +To receive important updates, including breaking changes announcements, +watch the Azure App Service announcements repository. 🚧 ## Overview -PowerShell support for Functions is based on [PowerShell Core 6.1](https://github.com/powershell/powershell), [Functions on Linux](https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/functions-on-linux-preview/), and the [V2 Runtime](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions). +PowerShell support for Functions is based on [PowerShell Core 6.1](https://github.com/powershell/powershell), +[Functions on Linux](https://blogs.msdn.microsoft.com/appserviceteam/2017/11/15/functions-on-linux-preview/), +and the [V2 Runtime](https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions). What's available? @@ -19,7 +26,13 @@ A ton of good things. ## Contributing -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +> This project is **not currently taking pull requests** +because it's still in the early development and is changing rapidly. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) +with any additional questions or comments. ## Building from source @@ -32,38 +45,68 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope * Clone this repository * `cd azure-functions-powershell-worker` * `dotnet publish` +* Make note of the location of the publish directory: +`src/bin/Dubug/netcoreapp2.1/publish` ### Run & Debug -The PowerShell worker alone is not enough to establish the functions app, we also need the support from [Azure Functions Host](https://github.com/Azure/azure-functions-host). You may either use a published host CLI or use the in-development host. But both of the methods require you to attach to the .NET process if you want a step-by-step debugging experience. +The PowerShell worker alone is not enough to establish the functions app, we also need the support from +[Azure Functions Host](https://github.com/Azure/azure-functions-host). +You may either use a published host CLI or use the in-development host. +But both of the methods require you to attach to the .NET process if you want a step-by-step debugging experience. #### Published Host -You can install the latest Azure functions CLI tool by: +First, follow the [instructions to install the Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools#installing). +Then locate the `azure-functions-core-tools\bin\workers\` folder. +Here are a few hints on where it could be located: -```sh -npm install -g azure-functions-core-tools@core +On Windows if you installed via `npm` +``` +~\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\ +``` +On macOS if you installed via `brew` +``` +/usr/local/Cellar/azure-functions-core-tools//workers/ +``` + +Copy the result of the `publish` directory into a `powershell` folder under `workers` so it looks something like: +``` +/usr/local/Cellar/azure-functions-core-tools//workers/powershell/ ``` -By default, the binaries are located in `"/.azurefunctions/bin"`. Copy the `"/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"/.azurefunctions/bin/workers/powershell/"`. And start it normally using: +Then `cd` into a Function App with PowerShell as the worker runtime +(NOTE: There's an example PowerShell Function App in the `examples` folder). -```sh +Lastly, run: + +``` func start ``` #### Latest Host -A developer may also use the latest host code by cloning the git repository [Azure Functions Host](https://github.com/Azure/azure-functions-host). Now you need to navigate to the root folder of the host project and build it through: +A developer may also use the latest host code by cloning the git repository [Azure Functions Host](https://github.com/Azure/azure-functions-host). +Now you need to navigate to the root folder of the host project and build it through: ```sh dotnet restore WebJobs.Script.sln dotnet build WebJobs.Script.sln ``` -After the build succeeded, set the environment variable `"AzureWebJobsScriptRoot"` to the root folder path (the folder which contains the `host.json`) of your test functions app; and copy the `"/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"/src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.0/workers/powershell"`. Now it's time to start the host: +After the build succeeded, +set the environment variable `"AzureWebJobsScriptRoot"` +to the root folder path (the folder which contains the `host.json`) +of your test functions app. + +Then copy the `publish` directory to +`"/src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.1/workers/powershell"`. +Then you can start the host but running: ```sh -dotnet ./src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.0/Microsoft.Azure.WebJobs.Script.WebHost.dll +dotnet ./src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.1/Microsoft.Azure.WebJobs.Script.WebHost.dll ``` -> Note: Remember to remove `"AzureWebJobsScriptRoot"` environment variable after you have finished debugging, because it will also influence the `func` CLI tool. +> Note: Remember to remove `"AzureWebJobsScriptRoot"` +environment variable after you have finished debugging, +because it will also influence the `func` CLI tool.