gpt4 book ai didi

azure - 使用API​​或SDK在Azure中上传模板

转载 作者:行者123 更新时间:2023-12-01 22:23:55 25 4
gpt4 key购买 nike

我希望使用Go SDK或Rest API以编程方式在Azure中上载VM部署模板。我找不到相同的正确文档。

另外,我也不想启动VM部署。仅限将部署模板上传到Azure。

enter image description here

最佳答案

好,这是将空模板放入门户的示例api请求:

{
"name": "test",
"type": "Microsoft.Gallery/myareas/galleryitems",
"properties": {
"publisherName": "username_goes_here",
"publisherDisplayName": "username_goes_here",
"displayName": "test",
"description": "test",
"artifacts": {
"default": {
"name": "template",
"type": "template",
"uri": "https://gallery.azure.com/artifact/20161101/Microsoft.MyGallery.0.0.9-preview/DeploymentTemplates/EmptyTemplate.json"
}
},
"images": [
{
"context": "ibiza",
"items": [
{
"name": "large",
"type": "icon",
"uri": "https://gallery.azure.com/GalleryRp/Content/GalleryItemDefaultLargeIcon.png"
}
]
}
],
"version": "1.0.0",
"uiDefinitionUri": "",
"publishingState": "stable",
"categoryIds": [],
"links": []
}
}

放置: https://management.azure.com/providers/Microsoft.Gallery/myareas/df010a79-26a3-401a-8697-a5736c82895a/galleryItems/test?api-version=2016-03-01-preview

不确定从何处获取guid,可能必须手动创建第一个,否则对myareas的get请求将显示可能区域的列表

不幸的是,我在任何地方都没有看到此文档。

编辑:我能够找到提供程序的操作列表:
{
"namespace": "Microsoft.Gallery",
"resourceTypes": [
{
"resourceType": "myareas",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "myareas/areas",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "myareas/areas/areas",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "myareas/galleryitems",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "myareas/areas/galleryitems",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "myareas/areas/areas/galleryitems",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "enroll",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "register",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "galleryitems",
"locations": "",
"apiVersions": "2016-03-01-preview 2014-04-01-preview",
"capabilities": "None"
},
{
"resourceType": "resources",
"locations": "",
"apiVersions": "2016-03-01-preview 2014-04-01-preview",
"capabilities": "None"
},
{
"resourceType": "retrieveresourcesbyid",
"locations": "",
"apiVersions": "2016-03-01-preview 2014-04-01-preview",
"capabilities": "None"
},
{
"resourceType": "generateartifactaccessuri",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
},
{
"resourceType": "checknameavailability",
"locations": "",
"apiVersions": "2016-03-01-preview",
"capabilities": "None"
}
]
}

所以我不认为它是UI代理。它似乎是一个真正的提供者,但它似乎位于租户级别上?注意URL: https://management.azure.com/providers

编辑:是的,我可以通过此调用获取我的区域列表: https://management.azure.com/providers/microsoft.gallery/myareas/?api-version=2020-01-01
它将返回到目前为止我唯一的区域:df010a79-26a3-401a-8697-a5736c82895a

关于azure - 使用API​​或SDK在Azure中上传模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61185357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com