azure-maven-plugins icon indicating copy to clipboard operation
azure-maven-plugins copied to clipboard

Non production deployment slots are using the same storage resource as the production slot

Open adeabayyup opened this issue 2 years ago • 2 comments

Plugin name and version

azure-functions-maven-plugin, version 1.21.0

Plugin configuration in pom.xml

<plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-functions-maven-plugin</artifactId>
        <version>${azure.functions.maven.plugin.version}</version>
        <configuration>
          <resourceGroup>${functionResourceGroup}</resourceGroup>
          <appName>${functionAppName}</appName>
          <region>${functionAppRegion}</region>
          <authType>azure_cli</authType>
          <runtime>
            <os>windows</os>
            <javaVersion>11</javaVersion>
          </runtime>
          <deploymentSlot>
            <name>stage</name>            
          </deploymentSlot>
          <appSettings>
            <property>
              <name>FUNCTIONS_EXTENSION_VERSION</name>
              <value>~4</value>
            </property>
          </appSettings>
        </configuration>
</plugin>

Expected behavior

If you deploy to stage when the 'stage' deployment slot doesn't exist, it will create a new deployment slot named 'stage' and copy the configuration settings of parent (prod). It should not copy application settings like WEBSITE_CONTENTSHARE and should create new storage for the new deployment slot and rewrite slot specific settings accordingly.

Actual behavior

All the parent application settings are copied to deployment slot's settings including WEBSITE_CONTENTSHARE. As a result both slots are reading the code from the same storage and you're effectively overwriting production code when you deploy to stage slot. I'm getting an issue similar to this.

Steps to reproduce the problem

  • Deploy your app using ./mvnw clean package azure-functions:deploy
  • By default it will deploy to production slot and create additional resources
  • Add this to pom.xml file
      <deploymentSlot>
              <name>stage</name>            
      </deploymentSlot> 
    
  • Deploy again and view the application settings of the stage slot. It will be same as the parent.

adeabayyup avatar Nov 04 '22 13:11 adeabayyup

@AidenFawkes Thanks a lot for your report and really sorry for the late response. We are using run from package deployment by default, which deployment in slot should not affect product deployment. Could you please help share us a demo project to reproduce this issue if possible?

As a workaround, if you want to have fresh app settings for the slot, you may set <configurationSource> as new, however, you may need to specify all app settings/configuration manually for the new slot.

  <deploymentSlot>
          <name>new-slot</name>        
           <configurationSource>new</configurationSource>    
  </deploymentSlot> 

Flanker32 avatar Nov 30 '22 05:11 Flanker32

Could you please help share us a demo project to reproduce this issue if

@Flanker32 Thank you for responding. After creating the sample project I will reply to this thread

adeabayyup avatar Dec 01 '22 06:12 adeabayyup