1

https://marketplace.visualstudio.com/items?itemName=bradygaster.azuretoolsforvscode如何從vs代碼發佈azure函數?

我已經安裝了Azure的工具 - vscode,但並不確切地知道如何使用它發佈蔚藍的功能:

一些步驟,我曾嘗試爲:

的Windows PowerShell 版權所有(C)2015 Microsoft Corporation。版權所有。

PS d:\ azurenodejsfunctions>

PS d:\ azurenodejsfunctions> FUNC天青登錄

PS d:\ azurenodejsfunctions> FUNC天青帳戶設置

PS d:\ azurenodejsfunctions> FUNC天青functionapp發佈.. \ azurenodejsfunctions \

將D:\ azurenodejsfunctions內容發佈到Azure函數應用程序。本地刪除的文件不會從目標中刪除。 獲取網站發佈信息... 在當前訂閱中找不到名爲「.. \ azurenodejsfunctions \」的應用程序。

PS d:\ azurenodejsfunctions>


我累了另一種方式,手動創建蔚藍功能的應用程序,然後嘗試:

PS d:> FUNC蔚藍functionapp發佈azurenodejsfunctions

例外: 無法找到函數項目根目錄。期望在函數項目根目錄中有host.json。

文件和文件夾結構:

enter image description here

現在謎我。

回答

1

根據您的描述和錯誤消息,如果您想在Visual Studio代碼中發佈天青功能。您需要先在protal中創建一個azure函數,然後使用func azure functionapp publish命令將函數發佈到azure。

我建議你可以按照下面的方式。

1.安裝Visual Studio代碼的Azure工具。

用Ctrl + Shift + P打開命令和類型下面的命令:

ext install azuretoolsforvscode 

2.創建天青功能的應用程序。

用Ctrl + Shift + P打開下面命令的命令和類型:

azure:login 

Azure:Create an azure function App(advanced) 

enter image description here

3.使用CTRL + SHIFT + C打開命令窗口,並使用下面的命令安裝天青功能核心工具。

npm i -g azure-functions-core-tools 

4.Init蔚藍的功能當地

注意:函數名稱必須與你一樣已經在蔚藍

func init yourfunctionname 

5.Locate創建功能的應用程序功能的文件夾

cd yourfunctionname 

6.使用func azure登錄和func azure functionapp發佈發佈函數

像這樣的命令:

enter image description here