我正在使用azurerm_virtual_machine_extensionazure 引导一些虚拟机。
我发现的所有示例都使用类似于以下内容的内容:
settings = <<SETTINGS
{
"fileUris": [ "https://my.bootstrapscript.com/script.sh}" ],
"commandToExecute": "bash script.sh"
}
SETTINGS
Run Code Online (Sandbox Code Playgroud)
虽然这有效,但我的问题是我必须公开托管script以与fileUris. 设置中是否有允许我从 terraform 文件夹发送本地文件内容的选项?
就像是:
settings = <<SETTINGS
{
"file": [ ${file("./script.txt")} ],
"commandToExecute": "bash script.sh"
}
SETTINGS
Run Code Online (Sandbox Code Playgroud)
谢谢。
bootstrapping virtual-machine azure terraform terraform-provider-azure
创建需要安装位于 Azure 密钥保管库内的 SSL 证书的 ARM 模板。如果我用指纹指定证书,它工作正常:
https://contoso.vault.azure.net/secrets/web01-test-contoso-com/968bf207451149d3aceb390065af9d3a
Run Code Online (Sandbox Code Playgroud)
但由于证书是在滴答作响的时钟上,这对可能过时的依赖项进行硬编码到 ARM 模板中。我宁愿只指定最新版本(就像它在门户中显示的那样)。但是,我还没有找到任何说明如何做到这一点的文档,甚至没有提到可能的话。
我使用以下方法进行了几个实验:
https://contoso.vault.azure.net/secrets/web01-test-contoso-com
Run Code Online (Sandbox Code Playgroud)
和
https://contoso.vault.azure.net/secrets/web01-test-contoso-com/latest
Run Code Online (Sandbox Code Playgroud)
但是在这两种情况下,我都收到了相同的错误消息:
message '{
"error": {
"code": "InvalidParameter",
"message": "https://contoso.vault.azure.net/secrets/web01-test-contoso-com/latest is
not a valid versioned Key Vault Secret URL. It should be in the format
https://<vaultEndpoint>/secrets/<secretName>/<secretVersion>.",
"target": "certificateUrl"
}
}'
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:如何以获取最新版本的方式引用证书?
为清楚起见,我secrets将 ARM 模板部分中的 URL用于 VM,如下所示,它从 Azure 密钥保管库获取证书并将其安装到 Windows 证书存储中。
"secrets": [
{
"sourceVault": {
"id": "[resourceId(parameters('keyVaultResourceGroupName'), 'Microsoft.KeyVault/vaults', parameters('keyVaultName'))]"
},
"vaultCertificates": [
{
"certificateUrl": "https://contoso.vault.azure.net/secrets/web01-test-contoso-com/latest",
"certificateStore": "My"
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
注意:我觉得奇怪的是,您可以指定要安装的操作系统的最新版本,但不能指定安装最新版本的证书。
azure azure-resource-manager azure-keyvault azure-rm-template azure-template
所以我在 Flask RestPlus 中有这个模型:
NS = Namespace('parent')
PARENT_MODEL = NS.model('parent', {
'parent-id': fields.String(readOnly=True,
'parent-name': fields.String(required=True)
})
CHILD_MODEL = NS.inherit('child', SUBSCRIPTION_MODEL, {
'child-id': fields.String(required=True, readOnly=True),
'child-name': fields.String(required=True),
'child-some-property': fields.String(required=True)
})
CHILD_PROPERTY_MODEL = NS.inherit('child-other-property', RESOURCE_GROUP_MODEL, {
'child-other-property': fields.Raw(required=False)
})
Run Code Online (Sandbox Code Playgroud)
它没有按预期工作,我得到了这个输出(以及 swagger 文档上的类似结构)。
[
{
"parent-id": "string",
"parent-name": "string",
"child-id": "string",
"child-name": "string",
"child-some-property": "string",
"child-other-property": {}
}
]
Run Code Online (Sandbox Code Playgroud)
而不是这样的:
[
{
"parent-id": "string",
"parent-name": "string", {
"child-id": "string",
"child-name": "string",
"child-some-property": "string",{
"child-other-property": {}
}
}
}
]
Run Code Online (Sandbox Code Playgroud)
我可能错过了一些简单的东西,但不明白是什么。这就是我在 Flask …
在我的应用程序的 Azure Cosmo DocumentDB 中,出现以下错误
2018-03-27 14:42:057 错误 chmsCosmosDBFruiteService - 无法将 Fruites 添加到客户参考:11416e34-3620-45a4-b3be-b845bbf41762
消息:{“错误”:[“具有指定 id 或名称的资源已存在。”] ActivityId:1b70b944-d581-4640-8785-819400433bb4,请求URI:/apps/8d13f597-c7e4-4d60-8713-8a0e9abaa9ac/services/ce0d287f-0125-482b-b32c-22108b5b0ed3/partition s/42c80a49-8042-4032-8cfd -9937ecea8dcc/replicas/131662740073245648p,RequestStats:,SDK:Microsoft.Azure.Documents.Common/1.21.0.0,StatusCode:冲突2018-03-27 14:42:058错误chmaeGlobalExceptionHandler - 异常:类org.apache.catalina.connector .ClientAbortException 消息:java.io.IOException:现有连接被远程主机强制关闭 2018-03-27 14:42:058 警告 oswsmmaExceptionHandlerExceptionResolver - 无法调用 @ExceptionHandler 方法:public java.util.Map com.hm。 myfeed.api.exception.GlobalExceptionHandler.handleException(java.lang.Exception,org.springframework.web.context.request.WebRequest,javax.servlet.http.HttpServletRequest)org.apache.catalina.connector.ClientAbortException:java.io。 IOException:远程主机在 org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:356) 处强制关闭了 org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:815) 处的现有连接在 org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:720) 在 org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:391) 在 org.apache.catalina.connector.OutputBuffer.write (OutputBuffer.java:369)在org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)在org.springframework.security.web.util.OnCommitedResponseWrapper $ SaveContextServletOutputStream.write(OnCommitedResponseWrapper.java:639)
我有点不明白这一点。异常发生在代码中,该代码首先检查集合是否存在(存在),然后检查是否不创建它。显然创建将失败,集合存在!
创建函数
try {
fruitesDocument = documentClient.createDocument(getCollectionLink(), fruitesDocument , null, false).getResource();
} catch (DocumentClientException e) {
LOG.error("Could not add fruits for Customer Reference: " + fruitesModel.getId() + " " + e.getMessage()); …Run Code Online (Sandbox Code Playgroud) 我正在尝试从单个 ARM 模板一起部署多个 LogicApp 和其他资源。Test-AzureRmResourceGroupDeployment当我尝试使用我创建的模板进行操作时,它会抛出此错误
Code : InvalidTemplate
Message : Deployment template validation failed: 'The template resource 'MyLogicApp' at line '159' and column '9' is not valid: The resource identificator
'/subscriptions/8a506831-cc80-4512-b51b-6ed4cc32b2cd/resourceGroups/arm/providers/Microsoft.Web/' is malformed. Please see https://aka.ms/arm-template-expressions/#reference for usage
details.. Please see https://aka.ms/arm-template-expressions for usage details.'.
Run Code Online (Sandbox Code Playgroud)
这是从我的代码创建资源的块。
我似乎找不到任何与此相关的资源。请帮忙。谢谢
azure azure-resource-manager azure-logic-apps azure-rm-template
我正在尝试构建一个 ARM 模板并不断收到错误消息:
'The template resource 'udr-sub-w05-w05-w05-agw-10.10.10.32/27' for type
'Microsoft.Network/routeTables' at line '141' and column '5' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must
have segment length one greater than its resource name.
Run Code Online (Sandbox Code Playgroud)
创建路由表代码的嵌套模板如下:
{
"name": "[variables('routeTable1')]",
"type": "Microsoft.Network/routeTables",
"apiVersion": "[variables('routeTableApiVersion')]",
"location": "[resourceGroup().location]",
"properties": {
"routes": [
],
"disableBgpRoutePropagation": false
}
},
{
"name": "[variables('routeTable2')]",
"type": "Microsoft.Network/routeTables",
"apiVersion": "[variables('routeTableApiVersion')]",
"location": "[resourceGroup().location]",
"properties": {
"routes": [ …Run Code Online (Sandbox Code Playgroud) azure azure-resource-manager azure-rm-template azure-template
我正在使用 Azure,我注意到它为每个资源组和资源创建了一个如下所示的 ID。
对于资源组
/subscriptions/<Subscriptionid>/resourceGroups/<resourcegroupname>
对于资源,它看起来像这样
/subscriptions/<Subscriptionid>/resourceGroups/<resourcegroupname>/providers/Microsoft.Compute/disks/<disk name>
这是 azure 的唯一标识符。
这是什么类型的 URI,是 URL 还是 URN?
我对不同的Azure存储服务的用例有疑问:
这些服务有什么区别?以及何时使用它们,因为它们都在Azure的云平台上提供了相同的功能(存储)。
我正在尝试运行,
az aks install-cli
但出现错误提示
Downloading client to "/usr/local/bin/kubectl" from "https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/linux/amd64/kubectl"
Connection error while attempting to download client ([Errno 13] Permission denied: '/usr/local/bin/kubectl')
Run Code Online (Sandbox Code Playgroud)
如果我使用 sudo 我得到:
bash: sudo: command not found
Run Code Online (Sandbox Code Playgroud)
除了使用 sudo 之外,不确定如何提升权限
我们有一台有多个(自动)用户的计算机。(在 Microsoft Azure 上)。
如果我们尝试pip install在由其他用户创建的 conda 环境中使用,我们会收到“访问被拒绝”错误。
我们已经使用以下命令以管理员身份安装了 anaconda:
C:\Windows\Temp\Anaconda3.exe /InstallationType=AllUsers /AddToPath=1 /RegisterPython=1 /S
Run Code Online (Sandbox Code Playgroud)
如果我使用一个用户创建一个 condaenv,比如说_azbatchtask_20,我们就可以激活它,在里面安装包,然后停用它:
conda create -p D:\batch\tasks\shared\test-condaenv-users python=3.7 -y
conda activate D:\batch\tasks\shared\test-condaenv-users
pip install see
deactivate
Run Code Online (Sandbox Code Playgroud)
但是,如果我们现在在_azbatchtask_21下登录,并尝试在同一环境中安装新软件包,我们会收到奇怪的错误“访问被拒绝”:
conda activate D:\batch\tasks\shared\test-condaenv-users
Run Code Online (Sandbox Code Playgroud)
有效,但是:
pip install nltk
> Access is denied
Run Code Online (Sandbox Code Playgroud)
如果有用,我们使用以下命令检查了新创建的 condaenv 文件夹的权限
icacls D:\batch\tasks\shared\test-condaenv-users
NT AUTHORITY\SYSTEM:(I)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(IO)(F)
ae0f56229000000\_azbatch:(I)(F)
ae0f56229000000\_azbatch:(I)(OI)(CI)(IO)(F)
BUILTIN\Administrators:(I)(F)
BUILTIN\Administrators:(I)(OI)(CI)(IO)(F)
ae0f56229000000\WATASK_COMMON_GROUP:(I)(F)
ae0f56229000000\WATASK_COMMON_GROUP:(I)(OI)(CI)(IO)(F)
NT AUTHORITY\Authenticated Users:(I)(F)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(F)
Run Code Online (Sandbox Code Playgroud)
我们还尝试使用以下命令向所有人授予完全权限(但pip install此后仍然失败)
icacls D:\batch\tasks\shared\test-condaenv-users /grant "Everyone:(OI)(CI)F" /T …Run Code Online (Sandbox Code Playgroud)