由于答案是找不到页面,我试图使用以下代码检索公共 IP 的大小
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
);
NetworkResourceProviderClient networkResourceProviderClient = NetworkResourceProviderService.create(config);
PublicIpAddressListResponse PublicIpAddressListResponse =networkResourceProviderClient.getPublicIpAddressesOperations().listAll();
ArrayList<PublicIpAddress> PublicIpAddressList =PublicIpAddressListResponse.getPublicIpAddresses();
System.out.println(PublicIpAddressList.size());
使用 Azure AD ServicePrincipal 身份验证,它返回 - 0
使用带有“ https://management.azure.com/ ” API 的证书身份验证,它返回 - AuthenticationFailed:
Exception in thread "main" com.microsoft.windowsazure.exception.ServiceException: AuthenticationFailed: Authentication failed. The 'Authorization' header is not present or provided in an invalid format.
at com.microsoft.windowsazure.exception.ServiceException.createFromJson(ServiceException.java:290)
at com.microsoft.azure.management.network.PublicIpAddressOperationsImpl.listAll(PublicIpAddressOperationsImpl.java:1443)
at com.microsoft.azure.auth.Program.main(Program.java:50)
任何想法如何检索所有虚拟机的公共 IP 地址?或者如何对其进行身份验证以获取 IP 值?