if you’re working with the Azure Apps you should get to know with Kudu(Advanced) –
Kudu is the engine behind git deployments in Azure App Service. It can also run outside of Azure.
the simplest way to explore Kudu is by browsing to your site with this variation to your address site : https://yoursitename.scm.azurewebsites.net/
you can do lot of stuff with Kudu from browsing the App files ,view process explorer and install Site Extensions.
Access to Kudu with Powershell –
- get your App Service site Publish Profile
2. now that you got your profile open it via text editor and look for the Kudu site credentials ,look for ‘userName=”$YourWebSite” ‘ and then for the password
looks like ‘ userPWD=”SyqEZdjNDy9e1ZJhtG95BnKicBtB3XS0Cqc2mvAnxqYRKo9kLpmxHtkvcNYB” ‘
if you’re having all of those settings then now you’re ready to explore the Kudu with Powershell .
to explore the Kudu Site we will use the REST API of the Kudu Project
on the next example i’m gonna show you how to explore Kudu Site Extensions Gallery
open your Powershell ISE and lets get started –
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
### 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 Extension try { $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{$_} |
Enjoy !