Skip to content

Commit

Permalink
Merge pull request #23 from Yvand/releases/1.0.0.rc-8
Browse files Browse the repository at this point in the history
Releases/1.0.0.rc 8
  • Loading branch information
Yvand authored Dec 17, 2024
2 parents 0c80954 + dafebd9 commit 9bfa953
Show file tree
Hide file tree
Showing 14 changed files with 221 additions and 173 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/azure-functions-app-nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Node.js project to Azure Function App

on:
push:
branches: ["main"]
workflow_dispatch:

env:
AZURE_FUNCTIONAPP_NAME: ${{ vars.AZURE_FUNCTIONAPP_NAME }}
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
NODE_VERSION: '20.x'

jobs:
build-and-deploy:
runs-on: windows-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: 'Build project'
shell: bash
run: |
pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
npm install
npm run build
npm run test --if-present
npm prune --production # Remove dev dependencies
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The resources deployed in Azure are configured with a high level of security:
+ [Node.js 20](https://www.nodejs.org/)
+ [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local?pivots=programming-language-typescript#install-the-azure-functions-core-tools)
+ [Azure Developer CLI (AZD)](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
+ Be `Owner` of the subscription (or have [`Role Based Access Control Administrator`](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/privileged#role-based-access-control-administrator)), to successfully assign Azure RBAC roles to the managed identity, as part of the provisioning process
+ Have the built-in role `Owner`, or `Contributor` + [`Role Based Access Control Administrator`](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles/privileged#role-based-access-control-administrator), to successfully assign roles to the managed identity, as part of the provisioning process
+ To use Visual Studio Code to run and debug locally:
+ [Visual Studio Code](https://code.visualstudio.com/)
+ [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
Expand Down
2 changes: 1 addition & 1 deletion azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

name: functions-quickstart-spo-azd
metadata:
template: Yvand/[email protected]7
template: Yvand/[email protected]8
services:
api:
project: .
Expand Down
4 changes: 2 additions & 2 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"appSettings": {
"value": {
"TenantPrefix": "${TenantPrefix}",
"SiteRelativePath": "${SiteRelativePath}",
"TenantPrefix": "${APPSETTING_TenantPrefix}",
"SiteRelativePath": "${APPSETTING_SiteRelativePath}",
"WebhookHistoryListTitle": "webhookHistory"
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "functions-quickstart-spo-azd",
"version": "1.0.0.rc-7",
"version": "1.0.0.rc-8",
"author": {
"name": "Yvan Duhamel"
},
Expand All @@ -10,7 +10,7 @@
},
"description": "This Quickstart uses Azure Developer command-line (azd) tools to create functions for SharePoint Online",
"license": "MIT",
"main": "dist/src/functions-definition/*.js",
"main": "dist/src/functions/*.js",
"type": "module",
"scripts": {
"build": "tsc",
Expand Down
5 changes: 0 additions & 5 deletions src/functions-definition/funcs-debug-def.ts

This file was deleted.

8 changes: 0 additions & 8 deletions src/functions-definition/funcs-webhooks-def.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { HttpRequest, HttpResponseInit, InvocationContext } from "@azure/functions";
import "@pnp/sp/items/index.js";
import "@pnp/sp/lists/index.js";
import "@pnp/sp/subscriptions/index.js";
import "@pnp/sp/webs/index.js";
import { app, HttpRequest, HttpResponseInit, InvocationContext } from "@azure/functions";
import { CommonConfig, safeWait } from "../utils/common.js";
import { logError } from "../utils/loggingHandler.js";
import { getSharePointSiteInfo, getSpAccessToken, getSPFI } from "../utils/spAuthentication.js";

export async function getAccessToken(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
async function getAccessToken(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
const tenantPrefix = request.query.get('tenantPrefix') || CommonConfig.TenantPrefix;
try {
const token = await getSpAccessToken(tenantPrefix);
Expand Down Expand Up @@ -44,3 +40,6 @@ export async function getWeb(request: HttpRequest, context: InvocationContext):
return { status: errorDetails.httpStatus, jsonBody: errorDetails };
}
};

app.http('debug-getAccessToken', { methods: ['GET'], authLevel: 'admin', handler: getAccessToken, route: 'debug/getAccessToken' });
app.http('debug-getWeb', { methods: ['GET'], authLevel: 'function', handler: getWeb, route: 'debug/getWeb' });
Loading

0 comments on commit 9bfa953

Please sign in to comment.