这些问题与免费试用无关,请参阅https://azure.microsoft.com/en-us/pricing/free-trial-faq/的第一个常见问题解答。
对于Azure订阅的限制,请参见https://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits/。
似乎您无法使用管理证书在Azure门户的设置中上载的管理证书之后成功管理Azure服务。
Java中有部分示例代码用于验证Azure服务管理。
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.microsoft.windowsazure.Configuration;
import com.microsoft.windowsazure.core.utils.KeyStoreType;
import com.microsoft.windowsazure.management.configuration.ManagementConfiguration;
import com.microsoft.windowsazure.management.compute.ComputeManagementService;
import com.microsoft.windowsazure.management.compute.ComputeManagementClient;
import com.microsoft.windowsazure.management.network.NetworkManagementService;
import com.microsoft.windowsazure.management.network.NetworkManagementClient;
String uri = "https://management.core.windows.net/";
String subscriptionId = "<your subscription id>";
String keyStoreLocation = "<KeyStore.jks>";
String keyStorePassword = "<password for KeyStore>";
Configuration config = ManagementConfiguration.configure(
new URI(uri),
subscriptionId,
keyStoreLocation, // the file path to the JKS
keyStorePassword, // the password for the JKS
KeyStoreType.jks // flags that I'm using a JKS keystore
);
// For Compute Management
ComputeManagementClient computeManagementClient = ComputeManagementService.create(config);
//For Networing Management
NetworkManagementClient client = NetworkManagementService.create(config);
// Others like above
代码依赖于下面的一些maven仓库在pom.xml中需要添加到项目中。
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt</artifactId>
<version>0.8.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-compute</artifactId>
<version>0.8.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-svc-mgmt-network</artifactId>
<version>0.8.3</version>
</dependency>
对于Azure CLI的错误,我想你错过了一些必要的步骤,如下所示。
首先,使用命令login
和Azure用户名&密码连接您的Azure订阅。
$ azure login -u <[email protected]>
其次,切换导出证书的Azure服务管理模式。
$ azure config mode asm
最后,下载certiticate。
$ azure account cert export
然后,您可以在当前路径中找到名为<subscription-id>.pem
的证书文件。
有关详细信息,请参阅https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-connect/。
任何关于此主题,请随时让我知道。
您可以在此粘贴此代码的Java代码吗?当使用azure cli下载证书时,您遵循哪些步骤? –