What the Azure Admin needs to set up to transfer the MaceStyle Validator to the production tenant.
- Resource Group for the solution
- Azure Function App (Python 3.11, Consumption or App Service plan, UK South region)
- Storage Account (created automatically with the Function App)
- New App Registration in the prod tenant for SharePoint access
- API Permissions (Application, not Delegated):
Sites.Selected(site-scoped access — no tenant-wide permissions)
- Admin consent granted for this permission
- Per-site access granted via Graph API (see azure-admin-setup.md)
- Client Secret generated (note the expiry)
- Provide Stephen with the Tenant ID, Client ID, and Client Secret
A SharePoint site (e.g. /sites/StyleValidation) with:
- Document Library for uploading documents to be validated
- Style Rules list with columns:
- Title (text)
- RuleType (text)
- DocumentType (text)
- CheckValue (text)
- ExpectedValue (text)
- AutoFix (yes/no)
- Priority (number)
- UseAI (yes/no)
- Validation Results list with columns:
- Title (text)
- Status (text)
- IssuesFound (number)
- IssuesFixed (number)
- ReportHTML (multiple lines of text)
- ReportUrl (hyperlink)
- Custom columns on the Document Library:
- ValidationStatus (Choice: Not Validated, Validate Now, Validating..., Passed, Review Required, Failed)
- LastValidated (Date and Time)
- ValidationReport (Hyperlink)
- ValidationResultLink (Hyperlink)
Add these in the Function App Configuration > Application Settings:
| Setting | Example Value | Required |
|---|---|---|
SHAREPOINT_TENANT_ID |
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
Yes |
SHAREPOINT_CLIENT_ID |
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |
Yes |
SHAREPOINT_CLIENT_SECRET |
(from App Registration) | Yes |
SHAREPOINT_SITE_URL |
https://macegroup.sharepoint.com/sites/StyleValidation |
Yes |
ANTHROPIC_API_KEY |
(Claude API key) | Yes |
SHAREPOINT_DOC_LIBRARY_ID |
(GUID of the Document Library list) | Optional* |
SHAREPOINT_VALIDATION_RESULTS_ID |
(GUID of the Validation Results list) | Optional* |
*List IDs default to the dev tenant values. For production, get the list GUIDs from SharePoint (Site Settings > Site Contents > list settings URL contains the GUID).
An ARM template is provided at infra/logic-app.json that deploys a Consumption Logic App replicating the Power Automate flow. This is preferable for production because it lives in the Azure subscription alongside the Function App and can be deployed via ARM/DevOps.
The Logic App:
- Triggers when a document is created or modified in the SharePoint Document Library
- Filters to supported file types (.docx, .xlsx, .pptx, .vsdx, etc.)
- Sets ValidationStatus to "Validating..."
- Gets file content and base64-encodes it
- Calls the Function App (
POST /api/ValidateDocument) with JSON body:{ "itemId": "<SharePoint item ID>", "fileName": "<file name with extension>", "fileContent": "<base64 encoded file content>", "fileUrl": "<server-relative path>" } - Parses the JSON response (fields:
status,description,issuesFound,issuesFixed,reportUrl,fixedFileContent) - If fixes were applied, uploads the corrected file back to SharePoint
- Updates ValidationStatus, Description, ValidationReport, ValidationResultLink, and LastValidated columns
az deployment group create \
--resource-group rg-mace-style-validator \
--template-file infra/logic-app.json \
--parameters infra/logic-app.parameters.json \
--parameters functionAppKey="<function-host-key>"Fill in functionAppKey and sharepointDocLibraryId in the parameters file (or pass on the command line). After deployment, open the Logic App in the Azure Portal and authorise the SharePoint connection (API Connections > sharepointonline > Edit > Authorize).
An azure-pipelines.yml is provided in the repo root. It automates:
- Build: Install deps, run tests, create deployment zip
- Deploy to Dev: Deploys Function App to
func-mace-validator-dev - Deploy to Prod: Deploys Function App to
func-mace-validator-prod(requires approval) - Deploy Logic App: Deploys the ARM template to the resource group
- Create a Service Connection (type: Azure Resource Manager) named
MaceStyle-ServiceConnectionwith access to the target subscription - Create Environments named
devandproductionin Azure DevOps Pipelines > Environments - Add an Approval gate on the
productionenvironment - Import the pipeline from
azure-pipelines.yml - Update the variables at the top of the YAML if resource names differ
Pushes to main trigger the full pipeline: build → dev → prod (with approval).
The Function App needs outbound HTTPS access to:
| Endpoint | Purpose |
|---|---|
graph.microsoft.com |
SharePoint / Microsoft Graph API |
api.anthropic.com |
Claude AI for style corrections |
login.microsoftonline.com |
Azure AD authentication |
The validator handles:
- Word: .docx, .doc, .docm, .dotx, .dotm
- Excel: .xlsx, .xls, .xlsm
- PowerPoint: .pptx, .ppt, .pptm, .potx, .potm
- Visio: .vsdx, .vsd
- The code (GitHub repo — includes Function App, Logic App ARM template, and DevOps pipeline)
- The
populate_style_rules.pyscript to seed the Style Rules list with all validation rules - ARM template + parameters for the Logic App (
infra/logic-app.json) - Azure DevOps pipeline definition (
azure-pipelines.yml)
Contact: stephen.cummins@macegroup.com