How can I download the Azure Bot source code in Python? - azure

Via the link below I know it is possible to create a Web App Bot in Python and to deploy it. At the moment I have a created a bot remotely in Azure using QnA Maker, and I was hoping to download the source code in Python and build some feature locally and deploy it afterwards. I am currently stuck at this, because the download source code options only lets me download the source code in C#. In Configuration -> General settings -> Stack settings, I changed the Stack to Python already, but this seems to have no effect. Thus I have 2 questions:
How can I download the bot's source code in Python?
If the Stack setting did not change the source code, what is this setting's purpose?
Please let me know whether I need to change/add something to this question and/or problem statement. Thanks a lot!
link: https://learn.microsoft.com/en-us/azure/bot-service/python/bot-builder-python-quickstart?view=azure-bot-service-4.0

You can't download python source code off azure, because there are no templates on Azure for python. The only templates that exist are node and C#. When you clicked the 'Create a bot' on Azure, there is a setting in the creation blade that shows what language to create your bot in:
I'm not sure how you're downloading your source code, as when I got to my bots to get the code, there isn't an option to change my language, only a prompt asking if I want my app settings and keys.
The bot framework samples repo has a sample QnA bot here. You can add your qna keys into this bot, test locally and deploy from local up to azure. But there is no way to pull 'source code' in python from azure.

Related

How to download/clone source code from Azure App Service to local machine using azure-cli/powershell

I happened to check an article which explained on how to download Azure app service source code:
How to download Azure App Service Source Code Download
I would like to have something similar to be achieved (leveraging azure-cli/powershell), but based on following order:
Step 1: Download app service source code using azure-cli / powershell commands
Step 2: modify source code (locally)
Step 3: create a zip of source code (locally)
Step 4: Stop app service using azure-cli / powershell commands (getting it ready for deployment)
Step 5: Deploy the zip using azure-cli / powershell commands
Step 6: Start app service once the deployment is succesfull
I was reading a lot about azure-cli in order to work with app service. Most of the articles start with creating an app and in my case, I have to start with an existing (already deployed) app. I couldn't find an article which actually shows on how to download/clone an existing app service on to local machine (other than using git endpoint). In the above, "Step 1" itself is a major hurdle for me.
Also, in this scenario, I would like to avoid "git" (based clone/push/deployments) if at all possible. No offence on using Git, but, just wanted to learn other available options.
If I can have (azure-cli/powershell) examples for Steps 1, 4, 5 and 6, they will help me learn quite a bit.
First of all, your order is not recommended. For safety, developers would rarely publish the source code directly in most instances.
If you want to download your own project published to Azure already, the best way is using FTP, which you post with the link.
Just a reminder, even you could download the source code, as I said, it is the code compiled, which would cause some mess when you use it. So store you source code well to avoiding this situation.

Virtual assistant template and integrating skills

I have been trying the newly launched virtual assistant template (C#) of the bot framework, downloaded it from here https://github.com/microsoft/botframework-solutions/tree/master/templates/Virtual-Assistant-Template/csharp and deployed it using deployment scripts and the default setup works well.
As a next step, tried to add remote skill (few of the existing skills such as Calendar) using relevant script and it worked too.
Basic question we have is, would we need to download existing skill from here https://github.com/microsoft/botframework-solutions/tree/master/templates/Skill-Template/csharp and deploy it in our own Azure environment or can we just use already published skills such as thishttps://bftodoskill.azurewebsites.net/api/skill/manifest
If yes, that's perfect! however if not - will it make sense for the bot framework team to release skills as a service so that end users can simply consume already available and published skills in their virtual assistants?
Looks like they are in the process of working on the publish scripts for Skills:- https://github.com/microsoft/botframework-solutions/issues/1496.
However, you should be able to manually build the Skills by leveraging the source code located here (disclaimer: not tried myself): https://github.com/microsoft/botframework-solutions/tree/master/skills/src/csharp.
UPDATE: You can find the deployment scripts for a given Skill under the Deployment/Scripts folder in the root of the Skill's directory (e.g. /skills/src/csharp/calendarskill) in the repo. Instructions on how to run these scripts can be found at: https://github.com/microsoft/botframework-solutions/blob/master/docs/tutorials/assistantandskilldeploymentsteps.md.

What is the best way to move an online Azure Function to a local git repository?

I have written an Azure Function App by using the User Interface of Azure Portal. The code is written in C#.
Now, I want to:
download all of the relevant code and configuration files of this
function app
Create an IDE project (e.g. IntelliJ, Visual Studio Code, ...)
store it in a git repository
Deploy the code from IDE or command line to Azure and thereby replacing the previously written Azure function.
So far, I have found only documentation on how to initiate Azure function projects with no previous code. Does somebody know how to do above?
Yes, you could go to your function Overview page, click on Download app content as shown below.
And in your situation, you want configuration files, so select the Content and Visual Studio Project and Include app settings in the download. What is app settings? This will include a local.settings.json file which contains your application settings.
Also the third party .dlls are included.
In the VS, select the folder and it will be working.
Update:
Open the function with vs, then just right click the function and choose Publish, it will show you the publish page. Click start, then you will be able to publish it to a existing Function.
Follow this Setting up a CI/CD pipeline for Azure Functions doc which explain each step in detail.

Where can i find the code of an Azure Function?

I'm new to Azure Functions and been thrown into a project without a proper introduction and anybody I could ask is out of office. My simple most likely stupid question is; where can I find the actual code?
In the azure portal, the functions are listed as "read-only" and only contains a function.json. The resource is an App Service and it has a couple of functions. There is no link to any git repository in properties.
Read-only Functions would be compiled and published (e.g. through Visual Studio or a CI/CD pipeline.) The Azure Functions Portal engineers are working on a new, improved experience for this but for now, if your Function app has a deployment source configured, you can view it from the Portal in two ways from your Function app:
Platform Features > Deployment Options.
Platform Features > Resource Explorer. In the file tree on the lefthand side, find your Function app's name, and under that, sourcecontrols. Click to expand in the righthand window.
If your Function app doesn't have a deployment source configured (e.g. your team has been publishing code manually) then things get harder. Depending on how your company has set up their source control and what you already have access to, the function.json you see might help: the entryPoint property in a build-generated function.json will give you the full assembly name of that function (e.g. VSSample.HelloSequence.Run). That or the assembly name of the uploaded DLL in the scriptfile property might help you locate the project.
Good luck! Keep posting if you have further questions; we're here to help.
AFAIK, if we create the azure function in the Visual Studio and publish it to Azure(there may be other ways), it will appear in the situation you described like the screenshot.
Actually, the code is existing in the portal, but the code has been compiled, you could access it in the Platform features -> Advanced tools (Kudu) -> Debug console.
If you want to get the .cs file, I think you should ask it for your coworkers, there will not be in azure.
You said that the Azure function is listed as "read-only". Did you check from the Application Settings menu if you can change the Azure function app edit mode to Read/Write?

Deployment custom App in Microsoft Teams

I am developing a chatbot azure service, which I want to integrate within Microsoft Teams. So far everything is working but the "re-install" of the package in the Microsoft Teams.
I created a publish "folder-profile". Then I zip the result with the manifest.json and the icon files inside. I go to the Manage Team section and in the Apps tab I select upload a custom app. Then I choose the .zip file and the service seems to be there(Actually it is there)
It works, but when I create a new version and I repeat the described steps, it seems like Microsoft Teams is still using my old code.
I test the chatbot in the Chat by using #"APP-ID" and I see how my changes work, but installed as an App for the "Team" keeps the old version.
I tried to uninstall it, check if the bot is gone(it is gone) and then upload again, but some kind of cache is there and the bot behaves like in the previous version.
Any idea how is the correct way to deploy new versions of my app in Microsoft Teams?
I think you need to upgrade the version number in the manifest.json file (you can do it in the manifest.source.json before to generate your zip).

Resources