Tôi đã cố gắng này thêm vào tập tin ServiceDefinition.csdef tôi:Windows Azure: làm cách nào để hiển thị cài đặt cấu hình dưới dạng biến môi trường?
<WorkerRole ...><Runtime><Environment>
<Variable name="AZURE_STORAGE_ACCOUNT">
<RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/ConfigurationSettings/ConfigurationSetting[@name='AZURE_STORAGE_ACCOUNT']/@value" />
</Variable>
</Environment></Runtime></WorkerRole>
Và tôi thiết lập trong file ServiceConfiguration.Cloud.cscfg của tôi cấu hình:
<Role name="WorkerRole">
<ConfigurationSettings>
<Setting name="AZURE_STORAGE_ACCOUNT" value="<secret stuff>" />
</ConfigurationSettings>
</Role>
Nhưng tôi đã nhận lỗi sau khi tôi chạy cspack
:
CloudServices091 : The '/RoleEnvironment/CurrentInstance/Configur
ationSettings/ConfigurationSetting[@name='AZURE_STORAGE_ACCOUNT']/@value' is an
invalid xpath expression.
Câu hỏi này bởi chính nó là đủ để giúp tôi đạt được mục tiêu, có đủ câu trả lời tích hợp sẵn. +1! –