Skip to content

more official readme with steps #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 6, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 65 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use semantic line breaks. The TL;DR; is that diff changes will show per line vs per paragraph and the rendering will put the lines back together as a paragraph anyways.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure I got everything


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. 🚧

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use bold:

**work in progress**

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


```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
```
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 [[email protected]](mailto:[email protected]) with any additional questions or comments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we call out that we don't accept PR contributions yet?
I think maybe we allow people to submit issues, as that's the way to get feedback.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added


## 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 `"<Home Folder>/.azurefunctions/bin"`. Copy the `"<Azure Functions PowerShell Worker Root>/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"<Home Folder>/.azurefunctions/bin/workers/powershell/"`. And start it normally using:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for Mac and Linux, right? The paths are different on Windows. We should list the paths on Windows too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've redone this section. It's a strange section to write because the core tools are installed with different package managers on all platforms and they're stored in different places. I've noted what we know so far.


```sh
func start
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func start needs to run in the function app folder, where host.json is located.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

```

#### 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 Root>/azure-functions-powershell-worker/src/bin/Debug/netcoreapp2.1/publish"` folder to `"<Azure Functions Host Root>/src/WebJobs.Script.WebHost/bin/Debug/netcoreapp2.0/workers/powershell"`. Now it's time to start the host:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The host is building against dotnet core 2.0? I see 2.1 in WebJobs.Script.Host.csproj:

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <Version>2.0.0-beta1$(VersionSuffix)</Version>
  </PropertyGroup>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


```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.