Skip to content

Conversation

@VasuBhog
Copy link
Contributor

@VasuBhog VasuBhog commented Mar 18, 2022

This PR changes the logic for Create Azure Function with SQL Binding. We used to first create an azure function and then have to use the command addSQLBinding to then add it to the specific function file that was created. This resulted in not the best practices of overwriting the function text body.

Now that the SQL Templates are released we should be able to leverage this (Azure/azure-functions-templates#1162). Based on what the user chooses we will create either a SqlInputBinding or SqlOutputBinding.

Current Flow:

  1. User uses Create Azure Function with SQL Binding from a selected table.
    a. If user doesn't have a function file go through create flow
  2. User chooses a function project folder (if many)
  3. Prompt for Function Name (placeholder of table name)
  4. Prompt for type of binding
  5. Prompt for namespace
  6. Issue - SQL Binding Templates shows storage account wizard #18780 if AzureWebJobsStorage in local.settings.json is empty
  7. Adds SQL Nuget Reference and adds connections string to local.settings.json file

Function file is created (shown below):
image

return;
}

await azureFunctionsUtils.addNugetReferenceToProjectFile(projectFile);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this? I thought the template added this for us as well.

Copy link
Contributor Author

@VasuBhog VasuBhog Mar 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just checked this. The template does add the NuGet reference.

<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Sql" Version="0.1.131-preview" />

@VasuBhog
Copy link
Contributor Author

VasuBhog commented Mar 18, 2022

In regards to the issue in step 6. There is an issue when AzureWebJobsStorage is an empty string as vscode-azurefunctions logic is set up to ask this question for everything except HTTP triggers.
https://github.com/microsoft/vscode-azurefunctions/blob/main/src/debug/validatePreDebug.ts#L123

The current workaround to suppress this set the AzureWebJobsStorage a placeholder value: Enter your Azure Web Jobs storage connection string.

@VasuBhog VasuBhog merged commit 1a1556c into main Mar 19, 2022
@VasuBhog VasuBhog deleted the vabhog/useSQLTemplate branch March 19, 2022 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants