VS Code 无法 Azure 函数扩展订阅错误

VS Code Can't Azure Function Extension subscription error

提问人:Lev Gelman 提问时间:11/16/2023 更新时间:11/18/2023 访问量:66

问:

我尝试使用 VS Code 创建一个新的 python Azure 函数, 我可以在我的订阅中列出资源组I can list of a resource groups in my subscriptions (我是订阅的所有者)

 list of a resource groups

但是当我尝试创建一个新函数(python - 3.11 - 消耗)时 我收到此错误:enter image description here

订阅数量正常

我尝试 Azure 注销并登录,即使使用机器代码, 我还重新启动了整台计算机。

我有 VS Code 的 1.84.2,这是最后一个,什么都无法更新

我能做些什么来解决这个问题?

谢谢!

azure visual-studio-code azure-functions

评论


答:

0赞 SiddheshDesai 11/18/2023 #1

即使我遇到了这个错误,为了解决这个错误。访问 VS CODE 中的帐户设置,并在 settings.json 文件中指定 Azure TenantID/SubscriptionID。重新加载 VS 代码并尝试创建函数应用,请参阅以下内容:-

enter image description here

enter image description here

enter image description here

我的settings.jsonazure.resourceFilter中包括tenantid / subscriptionid :-

请确保编辑 settings.json 文件,以包含指定 Azure 租户和订阅 IDazure.resourceFilter 设置。我有两个 Azure 帐户,因此,我指定了两个设置:-

我的settings.json:-

{
    "workbench.colorTheme": "Default Dark Modern",
    "azure.resourceFilter": [
        "xxxxxTenantIDxxx7cd011db47/xxxxSubscriptionID-xxx3f",
        "xxxxxTenantID7xxxx95/xxxxSubscriptionIDxxxe2b6e97cb2a7"
    ],
    "go.toolsManagement.autoUpdate": true,
    "circleci.hostUrl": "",
    "yaml.schemas": {
        "file:///c%3A/Users/username/.vscode/extensions/atlassian.atlascode-3.0.7/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
    },
    "editor.inlineSuggest.enabled": true,
    "workbench.editorAssociations": {
        "*.avro": "default",
        "*.pkl": "default"
    },
    "durableFunctionsMonitor.showWhenDebugSessionStarts": true,
    "settingsSync.ignoredExtensions": [
        


    ],
    "settingsSync.ignoredSettings": [

    ]
}
{
    "workbench.colorTheme": "Default Dark Modern",
    "azure.resourceFilter": [
        "TenantID/SubscriptionID",
        "TenantID/SubscriptionID"
    ],
    "go.toolsManagement.autoUpdate": true,
    "circleci.hostUrl": "",
    "yaml.schemas": {
        "file:///c%3A/Users/username/.vscode/extensions/atlassian.atlascode-3.0.7/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
    },
    "editor.inlineSuggest.enabled": true,
    "workbench.editorAssociations": {
        "*.avro": "default",
        "*.pkl": "default"
    },
    "durableFunctionsMonitor.showWhenDebugSessionStarts": true,
    "settingsSync.ignoredExtensions": [
        


    ],
    "settingsSync.ignoredSettings": [

    ]
}

保存 settings.json 文件,然后重新加载 VS Code 并再次尝试创建函数。

根据 ANANTHA BALAJI 的这个 SO 线程答案。D 尝试删除缓存在应用数据文件夹中的上述用户,该文件夹将在此处找到 - C:\Users\user\AppData\Roaming\Code\User,然后再次尝试安装 Azure Functions 扩展。

尝试再次卸载并重新安装 Azure Functions 扩展,然后重新加载 vs 代码:-

enter image description here

尝试通过 View > 命令登录 Azure 帐户 Pallette > Azure:登录 > 系统将提示你登录帐户, 登录到 Azure 帐户 > 成功后登录 > 转到 Azure 扩展并再次尝试创建函数应用:-

enter image description here

enter image description here

enter image description here

并创建您的函数:-

enter image description here

单击底部的登录帐户,然后选择您的订阅:-

enter image description here

enter image description here

enter image description here

从本部分验证 Azure 帐户:-

enter image description here

评论

0赞 Lev Gelman 11/19/2023
谢谢!我尝试添加租户/订阅的记录,还从C:\ Users \ user \ AppData \ Roaming \ Code \ User中删除了整个用户文件夹。但仍然有同样的错误:-(
0赞 SiddheshDesai 11/20/2023
@LevGelman 好的,尝试访问 Azure 帐户设置 > 显示设置> 在工作区中,清除所有筛选器,然后在 Azure:tenant >>搜索此 并在 Azure 租户 ID 中添加租户 ID,然后再次登录,请参阅此处 - i.imgur.com/svyZKKh.png 然后再次尝试创建函数应用。此外,在工作区中编辑 settings.json,就像在用户中一样,方法是添加 tenantId/subscriptionId- i.imgur.com/kDS6gcW.png i.imgur.com/tctOS2T.png
0赞 SiddheshDesai 11/20/2023
@LevGelman 可以使用的另一个命令是 Azure:选择“订阅”,然后在“View >command pallete”中选择 Azure 订阅。或者,在帐户、用户和工作区设置中,在此处添加订阅 - i.imgur.com/96PvS53.png
0赞 SiddheshDesai 11/20/2023
请参阅此 MS Q&A 答案以获取相同的内容 - learn.microsoft.com/en-us/answers/questions/382060/...
0赞 Lev Gelman 11/29/2023
经过长时间的挑战,我刚刚删除了 C:\Users\Myuser\AppData\Roaming\Code 文件夹,并从头开始配置了整个 VS Code,它就可以工作了。谢谢大家!