-
-
Save justinyoo/a2d36c1aa6ae678e9c3e18d03b838828 to your computer and use it in GitHub Desktop.
Entity Framework 7 Data Migration through KUDU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gets the website details. | |
$website = Get-AzureWebsite -Name "your-azure-website" | |
# Sets the KUDU endpoint URL. | |
$kuduApiBaseUri = "https://$($website.Name).scm.azurewebsites.net/api" | |
$uri = "$kuduApiBaseUri/command" | |
# Sets the request header. | |
$username = $website.PublishingUsername | |
$password = $website.PublishingPassword | |
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username, $password))) | |
$headers = @{ Authorization = ("Basic {0}" -f $base64AuthInfo) } | |
# Sets the request body in JSON format. | |
$body = ConvertTo-Json @{ command = "db-migration.cmd"; dir = "site\approot\src\MyWebAppProject" } | |
# Sends request to KUDU REST API | |
$result = Invoke-RestMethod -Uri $uri -Headers $headers -Method Post -Body $body -ContentType "application/json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment