locked
CDN enabled storage account - can I get the CDN domain name on a CloudBlob obj RRS feed

  • Question

  • Hi there, we have a storage account that is CDN enabled.  We have a custom domain name so folks goto the CDN our company domain name and not the default MSFT domain name.  Using the C# CloudBlob object, you can get the Uri of the file.  Is there a way for me to get "our company" CDN domain name and not the standard MSFT domain name?  I can simply perform a text replace on the domain name but I was wondering if there is a way to grab my company CDN friendly domain name instead.

    Thanks

    Tuesday, May 17, 2011 3:58 PM

Answers

  • Hello clay28,

    You are asking whether there is a method or API for getting a blob CDN uri which uses custom domain.

    As far as I know, at this time, Azure CDN does not support an API for this purpose. That means for now, we are not able to programmatically know if a blob object is in CDN or not and its CDN uri. I'm afriad creating the custom method will be the only way to go.

        public static string CdnUri(string Uri)
        {
            // You may read the value from ServiceConfiguration.cscfg.
            // string cdnDns = RoleEnvironment.GetConfigurationSettingValue("cdnDns");
            string cdnDns = "xxxxx.vo.msecnd.net";
            string cdnProtocol = "http";

            string baseAddress = string.Format("{0}://{1}/", cdnProtocol, cdnDns);

            return Regex.Replace(Uri, "^(http|https)://([^/]+)/", baseAddress);
        }

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • Marked as answer by clay28 Thursday, May 19, 2011 3:42 PM
    Thursday, May 19, 2011 9:17 AM

All replies

  • Here is the documentation on mapping CDN content to a custom domain.


    Brian Aurich
    Windows Azure Community PM
    Wednesday, May 18, 2011 6:26 PM
  • Hello clay28,

    You are asking whether there is a method or API for getting a blob CDN uri which uses custom domain.

    As far as I know, at this time, Azure CDN does not support an API for this purpose. That means for now, we are not able to programmatically know if a blob object is in CDN or not and its CDN uri. I'm afriad creating the custom method will be the only way to go.

        public static string CdnUri(string Uri)
        {
            // You may read the value from ServiceConfiguration.cscfg.
            // string cdnDns = RoleEnvironment.GetConfigurationSettingValue("cdnDns");
            string cdnDns = "xxxxx.vo.msecnd.net";
            string cdnProtocol = "http";

            string baseAddress = string.Format("{0}://{1}/", cdnProtocol, cdnDns);

            return Regex.Replace(Uri, "^(http|https)://([^/]+)/", baseAddress);
        }

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • Marked as answer by clay28 Thursday, May 19, 2011 3:42 PM
    Thursday, May 19, 2011 9:17 AM
  • Hi Brian and Wengchao, Thanks for your responses.  That answers my question.

    -clay28

    Thursday, May 19, 2011 3:39 PM