Skip to content

Latest commit

 

History

History
65 lines (49 loc) · 3.58 KB

README.md

File metadata and controls

65 lines (49 loc) · 3.58 KB

build codecov stryker

Azure DevOps Compliance - Azure Functions

Here is the home of the azure functions that evaluate projects in your Azure DevOps organization.

Deploy the latest release

shell:

export azdev_token=
export azdev_organization=
export extension_secret=
export extension_name=azure-devops-compliance
export extension_publisher=riezebosch

export rg=
export name=

az group create --name $rg --location westeurope
az storage account create -g $rg -n $name

function=$(az functionapp create -g $rg -n $name -s $name --consumption-plan-location westeurope --os-type windows --runtime dotnet-isolated --functions-version 4 -o tsv --query "id")
az ad sp create-for-rbac --name $name --role contributor --scopes $function --sdk-auth

az functionapp cors add -a https://$extension_publisher.gallerycdn.vsassets.io -n $name -g $rg
az functionapp config appsettings set --name $name --resource-group $rg --settings TOKEN=$azdev_token ORGANIZATION=$azdev_organization
az functionapp config appsettings set --name $name --resource-group $rg --settings EXTENSION_NAME=$extension_name EXTENSION_PUBLISHER=$extension_publisher EXTENSION_SECRET=$extension_secret  

curl https://github.com/azure-devops-compliance/azure-functions/releases/latest/download/release.zip -L --output release.zip
az functionapp deployment source config-zip -g $rg -n $name --src release.zip

powershell:

function Install-AzDevComplianceFunction {
    Param(
        [Parameter(Mandatory=$true)][String] $azdev_token,
        [Parameter(Mandatory=$true)][String] $azdev_organization,
        [Parameter(Mandatory=$true)][String] $extension_secret,
        [Parameter(Mandatory=$false)][String] $extension_name = "azure-devops-compliance",
        [Parameter(Mandatory=$false)][String] $extension_publisher= "riezebosch",
        
        [Parameter(Mandatory=$true)][String] $rg,
        [Parameter(Mandatory=$true)][String] $name
    )

    az group create --name $rg --location westeurope
    az storage account create -g $rg -n $name
    
    $function = az functionapp create -g $rg -n $name -s $name --consumption-plan-location westeurope --os-type windows --runtime dotnet-isolated --functions-version 4 -o tsv --query "id"
    az ad sp create-for-rbac --name $name --role contributor --scopes $function --sdk-auth
    
    az functionapp cors add -a https://$extension_publisher.gallerycdn.vsassets.io -n $name -g $rg
    az functionapp config appsettings set --name $name --resource-group $rg --settings TOKEN=$azdev_token ORGANIZATION=$azdev_organization
    az functionapp config appsettings set --name $name --resource-group $rg --settings EXTENSION_NAME=$extension_name EXTENSION_PUBLISHER=$extension_publisher EXTENSION_SECRET=$extension_secret  

    iwr https://github.com/azure-devops-compliance/azure-functions/releases/latest/download/release.zip -OutFile release.zip
    az functionapp deployment source config-zip -g $rg -n $name --src release.zip
}

Drop this function into your terminal and invoke it with the mandatory parameters afterwards.