Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webapp:Feature Request: Support Azure Site Extensions (Azure App Service) #7627

Open
tjrobinson opened this issue Oct 19, 2018 · 14 comments
Open
Assignees
Labels
App Services aka WebSites customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.

Comments

@tjrobinson
Copy link

Background

It's not currently possible to use either Azure PowerShell, or Azure CLI, to add/remove Azure Site Extensions. It can only be done using ARM templates, the REST API (steep learning curves for beginners, see below) or manually through the Azure Portal. I would like it to be easily scriptable alongside existing CLI or PowerShell scripts I use, including in Azure Cloud Shell.

Proposed Solution

Add the following commands:

Get-AzureRmWebAppExtension
   [[-Name] <String>]
   [-ResourceGroupName] <String>
   [-WebAppName] <String>
   [[-Slot] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Remove-AzureRmWebAppExtension
   [-Name] <String>
   [-Force]
   [-ResourceGroupName] <String>
   [-WebAppName] <String>
   [[-Slot] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

New-AzureRmWebAppExtension
   [-ResourceGroupName] <String>
   [-WebAppName] <String>
   [[-Slot] <String>]
   [-Name] <String>
   [-Version] <String>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Where Name would be the name of the nuget package, e.g. RemoveCustomHeaders (https://www.nuget.org/packages/RemoveCustomHeaders).

The New command could also update to either the latest version, or the specified version if already installed?

Alternatives

It's possible to configure Site Extensions using ARM templates but unless you are already using ARM templates, it's potentially a lot of work to get set up, especially for beginners: https://developer.rackspace.com/blog/Azure-WebApp-Extensions-with-ARM/

It's possible to call the Kudu REST API directly, though as you can see from this blog post, it's not straightforward: http://poshdb.com/home/install-azure-app-extension-powershell/

Additional context

Documentation on what Azure Site Extensions are: https://github.com/projectkudu/kudu/wiki/Azure-Site-Extensions

Blog post describing how to install and manage extensions via the Azure Portal: https://www.michaelcrump.net/azure-tips-and-tricks21/

Note that all Site Extensions are hosted on NuGet, with a tag of AzureSiteExtension: https://www.nuget.org/packages?q=Tags%3A%22AzureSiteExtension%22

Copying in @davidebbo (Dev manager on Azure Functions and Azure App Service).

I have raised a similar feature request for the Azure CLI here: Azure/azure-cli#7617

Thanks.

@davidebbo
Copy link

I can't comment on how likely this feature is to make it in. But do note that it is possible to install site extensions today using the low level PowerShell Azure Resource CmdLets. Full sample helpers here.

@tjrobinson
Copy link
Author

@davidebbo Thanks that's just what I need! It'd be great to get first class support for it but in the meantime I can use what you've linked to.

@tjrobinson
Copy link
Author

For the benefit of others, I've knocked up a quick standalone module:

# Based on https://github.com/davidebbo/AzureWebsitesSamples/blob/b566c5bcf2ad3c3783b70d0082a4fc83809181f4/PowerShell/HelperFunctions.ps1#L445-L469

$WebAppApiVersion = "2018-02-01"

Function GetResourceTypeAndName($SiteName, $Slot)
{
    $ResourceType = "Microsoft.Web/sites"
    $ResourceName = $SiteName
    if ($Slot) {
        $ResourceType = "$($ResourceType)/slots"
        $ResourceName = "$($ResourceName)/$($Slot)"
    }

    $ResourceType,$ResourceName
}

# Example call: ListWebAppSiteExtensions MyResourceGroup MySite
Function ListWebAppSiteExtensions($ResourceGroupName, $SiteName, $Slot)
{
    $ResourceType,$ResourceName = GetResourceTypeAndName $SiteName $Slot

    Get-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType $ResourceType/siteextensions -Name $ResourceName -ApiVersion $WebAppApiVersion
}

# Example call: InstallSiteExtension MyResourceGroup MySite filecounter
Function InstallSiteExtension($ResourceGroupName, $SiteName, $Name, $Slot)
{
    $ResourceType,$ResourceName = GetResourceTypeAndName $SiteName $Slot

    New-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType $ResourceType/siteextensions -Name $ResourceName/$Name -PropertyObject @{} -ApiVersion $WebAppApiVersion -Force
}

# Example call: UninstallSiteExtension MyResourceGroup MySite filecounter
Function UninstallSiteExtension($ResourceGroupName, $SiteName, $Name, $Slot)
{
    $ResourceType,$ResourceName = GetResourceTypeAndName $SiteName $Slot

    Remove-AzureRmResource -ResourceGroupName $ResourceGroupName -ResourceType $ResourceType/siteextensions -Name $ResourceName/$Name -ApiVersion $WebAppApiVersion -Force
}

Example usage:

param(
    [Parameter(Mandatory=$true)][string]$resourceGroupName,
    [Parameter(Mandatory=$true)][string]$extensionName
)

Import-Module .\SiteExtensions.psm1

$webApps = Get-AzureRmWebApp -ResourceGroupName $resourceGroupName

foreach($webApp in $webApps) {
    "Installing $extensionName into $($webApp.Name)"
    InstallSiteExtension $resourceGroupName $webApp.Name extensionName
}

@MiYanni MiYanni added App Services aka WebSites Service Attention This issue is responsible by Azure service team. feature-request This issue requires a new behavior in the product in order be resolved. labels Oct 19, 2018
@MiYanni
Copy link
Contributor

MiYanni commented Oct 19, 2018

@panchagnula @ahmedelnably Can you take a look at @tjrobinson's proposal?

@panchagnula
Copy link
Contributor

We do want to support site extensions, however, there is no ETA on this support from our end as yet.

@panchagnula panchagnula changed the title Feature Request: Support Azure Site Extensions (Azure App Service) webapp:Feature Request: Support Azure Site Extensions (Azure App Service) May 31, 2019
@panchagnula
Copy link
Contributor

@btardif will sync with you on the commandlet design for this.

@btardif btardif self-assigned this Jul 14, 2019
@btardif
Copy link
Member

btardif commented Jul 14, 2019

We are currently evaluating options for this request.

@btardif btardif added this to the 2019-10-08 milestone Aug 21, 2019
@btardif btardif assigned nking-1 and unassigned btardif Aug 21, 2019
@btardif
Copy link
Member

btardif commented Aug 21, 2019

this might be covered by #9342 but we need to validate the scenario once this cmdlets are available.

@panchagnula
Copy link
Contributor

with the work in #9342 the following will be enabled

Get-AzWebAppSiteExtension
Get-AzWebAppSiteExtensionSlot
Install-AzWebAppSiteExtension
Install-AzWebAppSiteExtensionSlot
Remove-AzWebAppSiteExtension
Remove-AzWebAppSiteExtensionSlot

@tjrobinson
Copy link
Author

@panchagnula Thanks. Do you have any idea when these commands will be publicly available?

@dingmeng-xue dingmeng-xue removed this from the S161 (2019-11-26) milestone Nov 19, 2019
@tjrobinson
Copy link
Author

@panchagnula I can see that Az.AppService 4.0.2-preview now has these commands but I received a 400 Bad Request when using them. Is there an ETA for V4 to be out of preview?

https://www.powershellgallery.com/packages?q=Cmdlets%3A%22Install-AzWebAppSiteExtension%22

See also: Azure/azure-rest-api-specs#2819

@omerzubair
Copy link

Hi Is there a command let to install extension to web app and function app ?

@omerzubair
Copy link

with the work in #9342 the following will be enabled

Get-AzWebAppSiteExtension
Get-AzWebAppSiteExtensionSlot
Install-AzWebAppSiteExtension
Install-AzWebAppSiteExtensionSlot
Remove-AzWebAppSiteExtension
Remove-AzWebAppSiteExtensionSlot

cant find it. do these exists?

@vienleidl
Copy link

I found this API and made these PowerShell scripts to find and remove installed site extensions from Azure App Service for your reference guys 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Services aka WebSites customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests