public AgentProperties findParametersForAzure( Logger logger ) {
		logger.info( "User data are being retrieved for Microsoft Azure..." );

		String userData = "";
		try {
			// Get the user data from /var/lib/waagent/ovf-env.xml and decode it
			String userDataEncoded = getValueOfTagInXMLFile( "/var/lib/waagent/ovf-env.xml", "CustomData" );
			userData = new String( Base64.decodeBase64( userDataEncoded.getBytes( StandardCharsets.UTF_8 )), "UTF-8" );

		} catch( IOException | ParserConfigurationException | SAXException e ) {
			logger.severe( "The agent properties could not be read. " + e.getMessage());
			Utils.logException( logger, e );
		}

		// Get the public IP Address from /var/lib/waagent/SharedConfig.xml
		AgentProperties result = null;
		String publicIPAddress;
		try {
			result = AgentProperties.readIaasProperties( userData, logger );
			publicIPAddress = getSpecificAttributeOfTagInXMLFile( "/var/lib/waagent/SharedConfig.xml", "Endpoint", "loadBalancedPublicAddress" );
			result.setIpAddress( publicIPAddress );

		} catch( ParserConfigurationException | SAXException e ) {
			logger.severe( "The agent could not retrieve a public IP address. " + e.getMessage());
			Utils.logException( logger, e );

		} catch( IOException e ) {
			logger.severe( "The agent could not retrieve its configuration. " + e.getMessage());
			Utils.logException( logger, e );
		}

		return result;
	}
public AgentProperties findParametersForAzure ( Logger logger ) { logger . info ( "User data are being retrieved for Microsoft Azure..." ) ; String userData = "" ; try { String userDataEncoded = getValueOfTagInXMLFile ( "/var/lib/waagent/ovf-env.xml" , "CustomData" ) ; userData = new String ( Base64 . decodeBase64 ( userDataEncoded . getBytes ( StandardCharsets . UTF_8 ) ) , "UTF-8" ) ; } catch ( IOException | ParserConfigurationException | SAXException e ) { logger . severe ( "The agent properties could not be read. " + e . getMessage ( ) ) ; Utils . logException ( logger , e ) ; } AgentProperties result = null ; String publicIPAddress ; try { result = AgentProperties . readIaasProperties ( userData , logger ) ; publicIPAddress = getSpecificAttributeOfTagInXMLFile ( "/var/lib/waagent/SharedConfig.xml" , "Endpoint" , "loadBalancedPublicAddress" ) ; result . setIpAddress ( publicIPAddress ) ; } catch ( ParserConfigurationException | SAXException e ) { logger . severe ( "The agent could not retrieve a public IP address. " + e . getMessage ( ) ) ; Utils . logException ( logger , e ) ; } catch ( IOException e ) { logger . severe ( "The agent could not retrieve its configuration. " + e . getMessage ( ) ) ; Utils . logException ( logger , e ) ; } return result ; }
Configures the agent from Azure.
@param logger a logger
@return the agent's data, or null if they could not be parsed