How to add an Azure App Service extension via powershell? How to add an Azure App Service extension via powershell? powershell powershell

How to add an Azure App Service extension via powershell?


You could check this example.

### Install NewRelic Extension for Azure App###write-output "*** Installing New Relic on PROD Site"$WebSite = "your site name"$Kudu = "https://" + $WebSite + ".scm.azurewebsites.net/api/extensionfeed" # Here you can get a list for all Extensions available.$InstallNRURI = "https://" + $WebSite + ".scm.azurewebsites.net/api/siteextensions" # Install API EndPoint$username = "`$UserName"$password = "hxWN9sjrqt9haA3NpG1kTK0QBui2ph7cEGQlcMQhYTiWqDWL9yf1aXGIJHTD"$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))$invoke = Invoke-RestMethod -Uri $Kudu -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method get ###-InFile $filePath -ContentType "multipart/form-data"$id = ($invoke | ? {$_.id -match "NewRelic*"}).id  ### Searching for NewRelic ID Extensiontry {    $InstallNewRelic = Invoke-RestMethod -Uri "$InstallNRURI/$id" -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Method Put    $Status = ($InstallNewRelic.provisioningState).ToString() + "|" + ($InstallNewRelic.installed_date_time).ToString()  ### Status    Write-Output "NewRelic Installation Status : $Status"    Restart-AzureRmWebApp -ResourceGroupName $ResourceGroupName -Name $WebSite -Verbose ### Restarting the WebApp}catch{$_}