示例#1
0
def aStorage(rg_name, suff):
    # Create an Azure resource (Storage Account)
    account = storage.Account(
        'storagerick' + suff,
        name='cicciopasticcio' + suff.lower(),
        # The location for the storage account will be derived automatically from the resource group.
        resource_group_name=rg_name,
        account_tier='Standard',
        account_replication_type='LRS',
        tags={
            "Environment": "Dev",
            "CostCenter": "12345"
        })
    # Export the connection string for the storage account
    return account.primary_connection_string
    def __init__(self, name: str, resource_group_name: str, index_html: str = None, network_rules=None, tags: dict = None, opts: pulumi.ResourceOptions = None):
        """
        :param resource_name: The name of the resource.
        :param resource_group_name: The name of resource group 
        :param index_html: The name of the index.html upload to $web container.
        :param network_rules: A `network_rules` block as documented below.
        :param tags: A mapping of tags to assign to the resource.
        :param opts: Options for the resource.

        The **network_rules** object supports the following:

          * `bypasses` (`pulumi.Input[list]`) - Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Valid options are
            any combination of `Logging`, `Metrics`, `AzureServices`, or `None`.
          * `default_action` (`pulumi.Input[str]`) - Specifies the default action of allow or deny when no other rules match. Valid options are `Deny` or `Allow`.
          * `ip_rules` (`pulumi.Input[list]`) - List of public IP or IP ranges in CIDR Format. Only IPV4 addresses are allowed. Private IP address ranges (as defined in [RFC 1918](https://tools.ietf.org/html/rfc1918#section-3)) are not allowed.
          * `virtual_network_subnet_ids` (`pulumi.Input[list]`) - A list of resource ids for subnets.
        """

        self.__account = storage.Account(name,
                                  resource_group_name=resource_group_name,
                                  account_tier="Standard",
                                  account_kind="StorageV2",
                                  account_replication_type="LRS",
                                  static_website={
                                      "indexDocument": "index.html",
                                      "error404Document": "error.html"
                                  },
                                  network_rules=network_rules,
                                  enable_https_traffic_only=True,
                                  tags=self.__get_tags(tags),
                                  opts=opts)

        if index_html is not None:
            storage.Blob("index.html",
                         name="index.html",
                         content_type="text/html",
                         storage_account_name=self.__account.name,
                         storage_container_name="$web",
                         type="Block",
                         source=pulumi.FileAsset(index_html),
                         opts=opts)
import pulumi
from pulumi_azure import core, storage, appservice

# Create an Azure Resource Group
location = pulumi.config.get_config('location')
print(location)

resource_group = core.ResourceGroup('my_pulumi_resource_group',
                                    location=location)

# Create an Azure resource (Storage Account)
account = storage.Account(
    'storage',
    # The location for the storage account will be derived automatically from the resource group.
    resource_group_name=resource_group.name,
    account_tier='Standard',
    account_replication_type='LRS')

# play around with some resource groups and maybe a function?
appService = appservice.Plan("appServicePlan",
                             resource_group_name=resource_group.name,
                             sku={
                                 "tier": "free",
                                 "size": "F1"
                             })

example_function = appservice.FunctionApp(
    "MyTestFunction",
    resource_group_name=resource_group.name,
    app_service_plan_id=appService.id,
    app_settings={"runtime": "python"},
示例#4
0
from pulumi import Config, export, asset, Output
from pulumi_azure import core, storage, appservice, appinsights, sql

username = "******"

config = Config()
pwd = config.require("sqlPassword")

resource_group = core.ResourceGroup("appservicerg")

storage_account = storage.Account("appservicesa",
                                  resource_group_name=resource_group.name,
                                  account_kind="StorageV2",
                                  account_tier="Standard",
                                  account_replication_type="LRS")

app_service_plan = appservice.Plan("appservice-asp",
                                   resource_group_name=resource_group.name,
                                   kind="App",
                                   sku={
                                       "tier": "Basic",
                                       "size": "B1",
                                   })

storage_container = storage.Container(
    "appservice-c",
    storage_account_name=storage_account.name,
    container_access_type="private")

blob = storage.Blob("appservice-b",
                    storage_account_name=storage_account.name,
示例#5
0

def createFirewallRules(arg):
    ips = arg.split(",")
    for ip in ips:
        rule = sql.FirewallRule("FR%s" % ip,
                                resource_group_name=resource_group.name,
                                start_ip_address=ip,
                                end_ip_address=ip,
                                server_name=sql_server.name)


resource_group = core.ResourceGroup("resourceGroup")

storage_account = storage.Account("storage",
                                  resource_group_name=resource_group.name,
                                  account_replication_type="LRS",
                                  account_tier="Standard")

container = storage.Container("files",
                              storage_account_name=storage_account.name,
                              container_access_type="private")

administrator_login_password = random.RandomPassword(
    "password",
    length=16,
    special=True,
).result

sql_server = sql.SqlServer(
    "sqlserver",
    resource_group_name=resource_group.name,
示例#6
0
    }],
    vpn_client_configuration={
        "rootCertificates": [{
            "name": root_certificates, 
            "publicCertData": public_certificate_data
            }],
        "vpnClientProtocols": ["IkeV2"],
        "address_spaces": [address_space]
        }
)
# preparation of the RHCOS image
# Create an Azure Storage Account
storageaccount = storage.Account("pulumistorage",
                          name=rhcos_storage_name,
                          resource_group_name=resource_group.name,
                          account_kind = 'StorageV2',
                          account_tier='Standard',
                          access_tier='Hot',
                          account_replication_type= 'LRS'
                          )

export('primary_connection_string', storageaccount.primary_connection_string)
export('primary_account_key', storageaccount.primary_access_key)
# Create an Azure storage container

storagecontainer = storage.Container("vhd",
                                  name="vhd",
                                  storage_account_name=storageaccount.name
                                )

# Create an Azure group 
resource_group_images = core.ResourceGroup('rhcos_images', name='rhcos_images')
示例#7
0
import pulumi
from pulumi_azure import core, storage

# Create an Azure Resource Group
resource_group = core.ResourceGroup("resource_group", 
    location='WestUS')

# Create an Azure resource (Storage Account)
account = storage.Account("storage", 
    resource_group_name=resource_group.name,
    location=resource_group.location,
    account_tier='Standard',
    account_replication_type='LRS')

# Export the connection string for the storage account
pulumi.export('connection_string', account.primary_connection_string)
示例#8
0
from pulumi import asset, export, Output
from pulumi_azure import core, storage, appservice

resource_group = core.ResourceGroup("windowsrg")

httpdotnet_storage_account = storage.Account(
    "httpdotnet",
    account_kind="StorageV2",
    account_tier="Standard",
    account_replication_type="LRS",
    resource_group_name=resource_group.name,
)

httpdotnet_container = storage.Container(
    "http-dotnet",
    storage_account_name=httpdotnet_storage_account.name,
    container_access_type="private")

httpdotnet_zib_blob = storage.ZipBlob(
    "http-dotnet",
    resource_group_name=resource_group.name,
    storage_account_name=httpdotnet_storage_account.name,
    storage_container_name=httpdotnet_container.name,
    type="block",
    content=asset.AssetArchive(
        {".": asset.FileArchive("./dotnet/bin/Debug/netcoreapp2.1/publish")}))

account_sas = storage.get_account_sas(
    connection_string=httpdotnet_storage_account.primary_connection_string,
    start="2019-01-01",
    expiry="2029-01-01",
示例#9
0
import pulumi
from pulumi_azure import core, storage

# Create an Azure Resource Group
resource_group = core.ResourceGroup("resource_group")

# Create an Azure resource (Storage Account)
account = storage.Account("storage",
                          resource_group_name=resource_group.name,
                          account_tier='Standard',
                          account_replication_type='LRS',
                          enable_https_traffic_only=True)

# Export the connection string for the storage account
pulumi.export('connection_string', account.primary_connection_string)
示例#10
0
from pulumi_azure import cdn, core, storage

from cloudflare import create_dns_record

config = Config(name="resume-infra")

domain = config.require("domain")
zone_id = config.require("zone_id")

resource_group = core.ResourceGroup('nvd-codes-resume')

account = storage.Account('resumestorage',
    resource_group_name=resource_group.name,
    account_tier='Standard',
    account_replication_type='LRS',
    enable_https_traffic_only=False,
    static_website={
        "indexDocument": "index.html",
    }
)

cdn_profile = cdn.Profile(
    "resume-cdn",
    resource_group_name=resource_group.name,
    sku="Standard_Microsoft"
)

endpoint = cdn.Endpoint(
    "resume-cdn-ep",
    resource_group_name=resource_group.name,
    profile_name=cdn_profile.name,
import pulumi
from pulumi_azure import core, storage

config = pulumi.Config()

# Create an Azure Resource Group
resource_group = core.ResourceGroup('resource_group')

account = storage.Account('storage',
                          resource_group_name=resource_group.name,
                          account_tier='Standard',
                          account_replication_type='LRS')

container = storage.Container('mycontainer',
                              name=config.require('container'),
                              storage_account_name=account.name)

pulumi.export('account_name', account.name)
示例#12
0
                               location=resource_group.location,
                               ip_configurations=[{
                                   'name':
                                   'ipconfig1',
                                   'subnet_id':
                                   subnet.id,
                                   'private_ip_address_allocation':
                                   'Dynamic',
                                   'public_ip_address_id':
                                   public_ip.id,
                               }])

sa = storage.Account(
    'diagnostics',
    resource_group_name=resource_group.name,
    location=resource_group.location,
    account_replication_type='LRS',
    account_tier='Standard',
)

user_data = """#!/bin/bash
echo "Hello, World!" > index.html
nohup python -m SimpleHTTPServer 80 &
"""

vm = compute.VirtualMachine('server-vm',
                            resource_group_name=resource_group.name,
                            location=resource_group.location,
                            network_interface_ids=[nic.id],
                            vm_size='Standard_A0',
                            delete_data_disks_on_termination=True,
                                   location='EastUs',
                                   resource_group_name=resource_group.name)

# Create an associated queue within the above namespace
servicebus.Queue('scheduled-tweets',
                 name='scheduled-tweets',
                 namespace_name=sbnamespace.name,
                 dead_lettering_on_message_expiration=True,
                 resource_group_name=resource_group.name,
                 max_size_in_megabytes=1024,
                 default_message_ttl=duration_isoformat(Duration(days=5)))

# Create an Azure Storage Account
scheduler_account = storage.Account('serverlessschedulerstore',
                                    name='serverlessschedulerstore',
                                    account_kind="StorageV2",
                                    resource_group_name=resource_group.name,
                                    account_tier='Standard',
                                    account_replication_type='LRS')

scheduler_plan = appservice.Plan("serverless-scheduler",
                                 name='serverless-scheduler',
                                 resource_group_name=resource_group.name,
                                 kind="FunctionApp",
                                 reserved=True,
                                 sku={
                                     "tier": "Dynamic",
                                     "size": "Y1"
                                 })

scheduler_app = appservice.FunctionApp(
    "serverless-scheduler",